るりまサーチ

最速Rubyリファレンスマニュアル検索!
804件ヒット [1-100件を表示] (0.145秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Object#class -> Class (24275.0)

レシーバのクラスを返します。

...レシーバのクラスを返します。

//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}

@see Class#superclass,Object#kind_of?,Object#instance_of?...

Module#public_class_method(*name) -> self (18441.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...ublic に変更します。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class
Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMeth...
...odError: private method `foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

Module#public_class_method(names) -> self (18441.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...ublic に変更します。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class
Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMeth...
...odError: private method `foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

Class#inherited(subclass) -> () (15349.0)

クラスのサブクラスが定義された時、新しく生成されたサブクラスを引数 にインタプリタから呼び出されます。このメソッドが呼ばれるタイミングは クラス定義文の実行直前です。

...ubclass プログラム内で新たに定義された自身のサブクラスです。

//emlist[例][ruby]{
class
Foo
def Foo.inherited(subclass)
puts "class \"#{self}\" was inherited by \"#{subclass}\""
end
end
class
Bar < Foo
puts "executing class body"
end

# => class "Foo" was inherit...
...ed by "Bar"
# executing class body
//}...

ARGF.class#getbyte -> Integer | nil (15235.0)

self から 1 バイト(0..255)を読み込み整数として返します。 既に EOF に達していれば nil を返します。

...
self
から 1 バイト(0..255)を読み込み整数として返します。
既に EOF に達していれば nil を返します。

ARGF はスクリプトに指定した引数(Object::ARGV を参照) をファイル名
とみなして、それらのファイルを連結した 1 つの仮想フ...
...cho "bar" > file2
$ ruby argf.rb file1 file2

ARGF.getbyte # => 102
ARGF.getbyte # => 111
ARGF.getbyte # => 111
ARGF.getbyte # => 10
ARGF.getbyte # => 98
ARGF.getbyte # => 97
ARGF.getbyte # => 114
ARGF.getbyte # => 10
ARGF.getbyte # => nil

@see ARGF.class#getc, ARGF.class#gets...

絞り込み条件を変える

Thread::Backtrace::Location#absolute_path -> String (15229.0)

self が表すフレームの絶対パスを返します。

...
self
が表すフレームの絶対パスを返します。

//emlist[例][ruby]{
# foo.rb
class
Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end

# => /path/to/foo.rb
# /path...
.../to/foo.rb
# /path/to/foo.rb
//}

@see Thread::Backtrace::Location#path...

Module#singleton_class? -> bool (12348.0)

self が特異クラスの場合に true を返します。そうでなければ false を返し ます。

...
self
が特異クラスの場合に true を返します。そうでなければ false を返し
ます。

//emlist[例][ruby]{
class
C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}...

Integer#to_bn -> OpenSSL::BN (12325.0)

Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。

...nteger を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'pp'
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class
...
...Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...
...Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class
Integer
d...
...ef to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...

Module#public_constant(*name) -> self (12320.0)

name で指定した定数の可視性を public に変更します。

...視性を public に変更します。

@param name 0 個以上の String か Symbol を指定します。

@raise NameError 存在しない定数を指定した場合に発生します。

@return self を返します。

//emlist[例][ruby]{
module SampleModule
class
SampleInnerClass
end

#...
...private にする
private_constant :SampleInnerClass
end

b
egin
SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInnerClass referenced>
end

module SampleModule
# => 非公開クラスであることは承知で利用するために public...
...にする
public_constant :SampleInnerClass
end

SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@see Module#private_constant, Object#untrusted?...
...にする
public_constant :SampleInnerClass
end

SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@see Module#private_constant...
<< 1 2 3 ... > >>