108件ヒット
[1-100件を表示]
(0.077秒)
クラス
- ERB (12)
-
IRB
:: Frame (12) - Method (12)
- Module (12)
- Tracer (12)
- UnboundMethod (24)
モジュール
-
Fiddle
:: Importer (12) - Kernel (12)
キーワード
-
bind
_ call (12) - httpd (12)
-
instance
_ method (12) - run (12)
-
trace
_ func (24) - unbind (12)
検索結果
先頭5件
-
UnboundMethod
# bind(obj) -> Method (24132.0) -
self を obj にバインドした Method オブジェクトを生成して返します。
...rror objがbindできないオブジェクトである場合に発生します
//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end
# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Fo......生成
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 の......"foo"
end
end
# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>
# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class Bar
include Foo
end
p m.bind(Bar.new)... -
Fiddle
:: Importer # bind(signature , *opts) { . . . } -> Fiddle :: Function (18208.0) -
Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。
...ます。
これでインポートされた関数はモジュール関数として定義されます。
また、Fiddle::Importer#[] で Fiddle::Function オブジェクトとして
取り出すことができます。
signature で関数の名前とシネグチャを指定します。例えば
"......関数を表す Fiddle::Function オブジェクトを返します。
@param signature 関数の名前とシネグチャ
@param opts オプション
例
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"
typealias "size_t", "unsigned long"
extern "in......t qsort(void*, size_t, size_t, void*)"
bind("int compare(void*, void*)"){|px, py|
x = px.to_s(Fiddle::SIZEOF_INT).unpack("i!")
y = py.to_s(Fiddle::SIZEOF_INT).unpack("i!")
x <=> y
}
end
data = [32, 180001, -13, -1, 0, 49].pack("i!*")
M.qsort(Fiddle::Pointer[d... -
Method
# unbind -> UnboundMethod (12407.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... -
UnboundMethod
# bind _ call(recv , *args) -> object (12137.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 (12137.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... -
Kernel
# httpd -> () (8007.0) -
WEBrick HTTP server を起動します。
...WEBrick HTTP server を起動します。
ruby -run -e httpd -- [OPTION] [DocumentRoot]
--bind-address=ADDR バインドアドレスを指定します
--port=NUM ポート番号を指定します
--max-clients=MAX 同時接続数の最大値
--temp-dir... -
IRB
:: Frame # trace _ func(event , file , line , id , binding) -> Binding (6301.0) -
ライブラリ内部で使用します。
ライブラリ内部で使用します。 -
ERB
# run(b=TOPLEVEL _ BINDING) -> nil (6201.0) -
ERB を b の binding で実行し、結果を標準出力へ印字します。
...ERB を b の binding で実行し、結果を標準出力へ印字します。
@param b eRubyスクリプトが実行されるときのbinding
//emlist[例][ruby]{
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
erb.run
# test foo
# test bar
//}... -
Tracer
# trace _ func(event , file , line , id , binding , klass , *) -> object | nil (6201.0) -
@todo
@todo -
Module
# instance _ method(name) -> UnboundMethod (207.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#publ......d(: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!
//}...