1656件ヒット
[1-100件を表示]
(0.029秒)
ライブラリ
- ビルトイン (947)
- erb (36)
- forwardable (24)
- json (132)
- logger (1)
- rake (12)
-
rdoc
/ top _ level (12) - singleton (12)
- timeout (12)
- win32ole (24)
クラス
- BasicObject (72)
- ERB (24)
- Method (213)
- Module (288)
- Object (120)
- Proc (26)
-
RDoc
:: TopLevel (12) -
RubyVM
:: InstructionSequence (12) - TracePoint (36)
- UnboundMethod (48)
-
WIN32OLE
_ EVENT (12) -
WIN32OLE
_ TYPE (12)
モジュール
-
ERB
:: DefMethod (12) - Forwardable (24)
-
JSON
:: Generator :: GeneratorMethods :: FalseClass (12) -
JSON
:: Generator :: GeneratorMethods :: NilClass (12) -
JSON
:: Generator :: GeneratorMethods :: Object (12) -
JSON
:: Generator :: GeneratorMethods :: String (12) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (12) - Kernel (72)
- Marshal (24)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - << (14)
- === (8)
- >> (14)
- Application (1)
- BasicObject (12)
- Error (12)
- FalseClass (24)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - NilClass (24)
- Numeric (12)
- ReFe (12)
- Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- Singleton (12)
- TrueClass (24)
- UnboundMethod (12)
- [] (12)
- arity (24)
- bind (12)
- call (24)
-
callee
_ id (12) - cgi (12)
-
cgi
/ session (12) -
class
_ exec (12) - clone (12)
- coverage (8)
- debug (12)
-
def
_ class (12) -
def
_ delegator (12) -
def
_ erb _ method (12) -
def
_ instance _ delegator (12) -
def
_ module (12) -
default
_ event _ sources (12) -
define
_ method (24) -
define
_ singleton _ method (24) - dump (24)
- fail (36)
-
find
_ local _ symbol (12) - handler= (12)
-
ins
_ methods _ i (12) -
ins
_ methods _ priv _ i (12) -
ins
_ methods _ prot _ i (12) - inspect (12)
-
instance
_ eval (24) -
instance
_ method (12) -
instance
_ methods (12) - irb (12)
-
irb
/ completion (12) - lambda? (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ id (12) -
method
_ missing (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
-
module
_ exec (12) - name (12)
- new (12)
-
original
_ name (24) - owner (24)
- parameters (12)
- private (48)
-
private
_ class _ method (24) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ class _ method (24) -
public
_ method (12) -
public
_ method _ defined? (12) - raise (36)
-
rake
_ extension (12) -
rb
_ catch (12) -
rb
_ class _ instance _ methods (12) -
rb
_ class _ private _ instance _ methods (12) -
rb
_ class _ protected _ instance _ methods (12) - rdoc (12)
-
rdoc
/ parser / c (12) - receiver (12)
-
remove
_ method (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) -
rexml
/ parsers / sax2parser (12) -
rexml
/ parsers / streamparser (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) - send (24)
-
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) -
source
_ location (12) -
super
_ method (11) -
to
_ a (12) -
to
_ json (48) -
to
_ json _ raw _ object (12) -
to
_ proc (12) -
to
_ s (12) - unbind (12)
-
undef
_ method (12) -
webrick
/ cgi (12) - クラス/メソッドの定義 (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
- リテラル (12)
- 制御構造 (12)
検索結果
先頭5件
-
Method (38106.0)
-
Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。
...ject#method によりオブジェクト化され
たメソッドオブジェクトのクラスです。
メソッドの実体(名前でなく)とレシーバの組を封入します。
Proc オブジェクトと違ってコンテキストを保持しません。
=== Proc との差
Method は......は使い捨てに向き、Method は何度も繰り返し生成する
場合に向くと言えます。また内包するコードの大きさという点では
Proc は小規模、Method は大規模コードに向くと言えます。
既存のメソッドを Method オブジェクト化する......//}
Method オブジェクトが有用なのは以下のような場合。
//emlist[例][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end
obj = Foo.new
# 任意のキーとメソッドの関係をハッシュに保持しておく
methods = {1 => obj.method(:... -
Method
# super _ method -> Method | nil (27290.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
...を Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclass m......ethod"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}... -
Method
# inspect -> String (21168.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジ......ュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo......def bar(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)... -
Method
# to _ s -> String (21168.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジ......ュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo......def bar(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)... -
Method
# inspect -> String (21162.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ......モジュール名、
method は、メソッド名を表します。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}
klass......が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)
特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列... -
Method
# to _ s -> String (21162.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ......モジュール名、
method は、メソッド名を表します。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}
klass......が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)
特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列... -
Method
# owner -> Class | Module (21147.0) -
このメソッドが定義されている class か module を返します。
...ソッドが定義されている class か module を返します。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.owner # => Foo
m = Foo.new.method(:puts) # => #<Method: Foo(Kernel)#puts>
m.owner # =>... -
Method
# clone -> Method (21141.0) -
自身を複製した Method オブジェクトを作成して返します。
...自身を複製した Method オブジェクトを作成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.call # => "foo"
m.clone # => #<Method: Foo#foo>
m.clone.call # => "foo"
//}... -
Method
# unbind -> UnboundMethod (21136.0) -
self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。
...いた UnboundMethod オブ
ジェクトを生成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
unbound_method = m.unbind # => #<UnboundMethod: Foo#foo>
unbound_method.bind(Foo.new) # => #<Method: Foo#foo>
//}... -
Method
# arity -> Integer (21066.0) -
メソッドが受け付ける引数の数を返します。
...uby]{
class C
def u; end
def v(a); end
def w(*a); end
def x(a, b); end
def y(a, b, *c); end
def z(a, b, *c, &d); end
end
c = C.new
p c.method(:u).arity #=> 0
p c.method(:v).arity #=> 1
p c.method(:w).arity #=> -1
p c.method(:x).......arity #=> 2
p c.method(:y).arity #=> -3
p c.method(:z).arity #=> -3
s = "xyz"
s.method(:size).arity #=> 0
s.method(:replace).arity #=> 1
s.method(:squeeze).arity #=> -1
s.method(:count).arity #=> -1
//}... -
Method
# parameters -> [object] (21046.0) -
Method オブジェクトの引数の情報を返します。
...Method オブジェクトの引数の情報を返します。
Method オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に応じた以下のような Symbol と、仮引数の名......ック引数
//emlist[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}
@s...