るりまサーチ

最速Rubyリファレンスマニュアル検索!
1838件ヒット [201-300件を表示] (0.045秒)

別のキーワード

  1. irb/input-method new
  2. irb/input-method gets
  3. _builtin define_method
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

クラス

モジュール

オブジェクト

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Method#eql?(other) -> bool (21014.0)

自身と other が同じインスタンスの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。

...ッドを表す場合に
true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。

//emlist[例][ruby]{
s = "bar"
a = s.method(:size)
b = s.method(:size)
p a == b #=> true
//}...

Method#hash -> Integer (21014.0)

自身のハッシュ値を返します。

...自身のハッシュ値を返します。


//emlist[例][ruby]{
a = method(:==)
b = method(:eql?)
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1
//}...

Method#name -> Symbol (21014.0)

このメソッドの名前を返します。

...このメソッドの名前を返します。

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.name # => :foo
//}...

Method#receiver -> object (21014.0)

このメソッドオブジェクトのレシーバを返します。

...のメソッドオブジェクトのレシーバを返します。

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.receiver # => #<Foo:0x007fb39203eb78>
m.receiver.foo(1) # => "foo called with arg 1"
//}...

Method#to_proc -> Proc (21014.0)

self を call する Proc オブジェクトを生成して返します。

...self を call する Proc オブジェクトを生成して返します。

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

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
pr = m.to_proc # => #<Proc:0x007f874d026008 (lambda)>
pr.call # => "foo"
//}...

絞り込み条件を変える

Method#original_name -> Symbol (21008.0)

オリジナルのメソッド名を返します。

...オリジナルのメソッド名を返します。

//emlist[例][ruby]{
class C
def foo; end
alias bar foo
end
C.new.method(:bar).original_name # => :foo
//}

@see UnboundMethod#original_name...

UnboundMethod#super_method -> UnboundMethod | nil (9215.0)

self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ クトにして返します。

...self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ
クトにして返します。


@see Method#super_method...

Module#method_defined?(name, inherit=true) -> bool (6271.0)

モジュールにインスタンスメソッド name が定義されており、 かつその可視性が public または protected であるときに true を返します。

...e#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module A
def method1() end
def protected_method1() end
protected :protected_method1
end
class B
def method2() end
def private_method2() end
private :private_method2
end
cl...
...def method3() end
end

A.method_defined? :method1 #=> true
C.method_defined? "method1" #=> true
C.method_defined? "method2" #=> true
C.method_defined? "method2", true #=> true
C.method_defined? "method2", false #=> false
C.method_defined? "method3"...
...#=> true
C.method_defined? "protected_method1" #=> true
C.method_defined? "method4" #=> false
C.method_defined? "private_method2" #=> false
//}...

Object#public_method(name) -> Method (6256.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...オブジェクトの public メソッド name をオブジェクト化した
Method
オブジェクトを返します。

@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、...
...vate メソッド名を引数として与えると発生します。

//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@see Object#method,Object#public_send,Module#public_instance_method...

Object#singleton_method(name) -> Method (6256.0)

オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。

...オブジェクトの特異メソッド name をオブジェクト化した Method オブ
ジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します...
...o.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}

@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method...

絞り込み条件を変える

Object#method(name) -> Method (6250.0)

オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。

...した
Method
オブジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。

//emlist[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#...
...abs>
p me.call #=> 365
//}

@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#singleton_method...
<< < 1 2 3 4 5 ... > >>