167件ヒット
[1-100件を表示]
(0.113秒)
別のキーワード
種類
- インスタンスメソッド (90)
- 文書 (44)
- 関数 (22)
- クラス (11)
ライブラリ
- ビルトイン (101)
クラス
- Binding (27)
- Method (31)
- Module (11)
- UnboundMethod (21)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - === (5)
- UnboundMethod (11)
- [] (5)
-
bind
_ call (10) -
bind
_ clone (11) - call (10)
- eval (11)
-
instance
_ method (11) -
rb
_ f _ binding (11) - receiver (10)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
source
_ location (6) - unbind (11)
検索結果
先頭5件
-
UnboundMethod
# bind(obj) -> Method (21247.0) -
self を obj にバインドした Method オブジェクトを生成して返します。
...
self を obj にバインドした Method オブジェクトを生成して返します。
@param obj 自身をバインドしたいオブジェクトを指定します。ただしバインドできるのは、
生成元のクラスかそのサブクラスのインスタンスのみで......e TypeError objがbindできないオブジェクトである場合に発生します
//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end
# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMet......ンスをレシーバとする Method オブジェクトを生成
p m.bind(Foo.new) # => #<Method: Foo#foo>
# Foo のサブクラス Bar のインスタンスをレシーバとする Method
class Bar < Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
# モジュ... -
UnboundMethod
# bind _ call(recv , *args) -> object (9258.0) -
self を recv に bind して args を引数として呼び出します。
...
self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call... -
UnboundMethod
# bind _ call(recv , *args) { . . . } -> object (9258.0) -
self を recv に bind して args を引数として呼び出します。
...
self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call... -
Method
# unbind -> UnboundMethod (9222.0) -
self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。
...
self のレシーバとの関連を取り除いた 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>
//}... -
Binding
# source _ location -> [String , Integer] (9116.0) -
self の Ruby のソースファイル名と行番号を返します。
...
self の Ruby のソースファイル名と行番号を返します。
d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。
//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}... -
static VALUE bind
_ clone(VALUE self) (6300.0) -
-
static VALUE rb
_ f _ binding(VALUE self) (6300.0) -
-
Module
# instance _ method(name) -> UnboundMethod (6134.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#publ......ic_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),......"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end
interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}... -
UnboundMethod (6036.0)
-
レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。
...あります。
Module#instance_method や
Method#unbind により生成し、後で
UnboundMethod#bind によりレシーバを
割り当てた Method オブジェクトを作ることができます。
//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のよ......methods = {1 => Foo.instance_method(:foo),
2 => Foo.instance_method(:bar),
3 => Foo.instance_method(:baz)}
# キーを使って関連するメソッドを呼び出す
# レシーバは任意(Foo クラスのインスタンスでなければならない)
p methods[1].bind(Foo......."baz"
//}
//emlist[例: 以下はメソッドの再定義を UnboundMethod を使って行う方法です。普通は alias や super を使います。][ruby]{
class Foo
def foo
p :foo
end
@@orig_foo = instance_method :foo
def foo
p :bar
@@orig_foo.bind(self).call
end
end
F... -
ruby 1
. 6 feature (3312.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) -> stable......BUG] Segmentation fault
ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby 1.6.7 (2002-03-15) [i586-linux]
: 2002-03-10 メソッドの戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返す......MatchData
Exception
Numeric
MatchData
Segmentation fault
=> ruby 1.6.5 (2001-10-15) [i586-linux]
MatchData
NotImplementedError
FloatDomainError
LoadError
Float
Binding... -
Binding
# receiver -> object (3122.0) -
保持するコンテキスト内での self を返します。
...保持するコンテキスト内での self を返します。
このメソッドは以下のコードと同様の動作をします。
//emlist[][ruby]{
binding.eval("self")
//}...