ライブラリ
- ビルトイン (93)
- e2mmap (6)
- erb (22)
-
fiddle
/ import (11) -
irb
/ frame (11) -
irb
/ xmp (11) -
rubygems
/ installer (33) -
rubygems
/ specification (11) - socket (44)
- tracer (11)
- un (11)
クラス
- Binding (60)
- ERB (22)
-
Gem
:: Installer (33) -
Gem
:: Specification (11) - IPSocket (11)
-
IRB
:: Frame (11) - Method (10)
- Module (11)
- Socket (11)
-
Socket
:: AncillaryData (11) - TracePoint (2)
- Tracer (11)
- UDPSocket (11)
- UnboundMethod (10)
モジュール
- Exception2MessageMapper (6)
-
Fiddle
:: Importer (11) - Kernel (22)
キーワード
-
add
_ bindir (11) -
bind
_ call (10) - binding (2)
- call (10)
- eval (11)
-
generate
_ bin _ script (11) -
generate
_ bin _ symlink (11) -
generate
_ windows _ script (11) - httpd (11)
-
instance
_ method (11) -
local
_ variable _ defined? (11) -
local
_ variable _ get (11) -
local
_ variable _ set (11) -
local
_ variables (10) - recvfrom (22)
-
recvfrom
_ nonblock (11) - result (11)
- run (11)
-
source
_ location (6) -
trace
_ func (22) - xmp (11)
検索結果
先頭5件
-
Fiddle
:: Importer # bind(signature , *opts) { . . . } -> Fiddle :: Function (21208.0) -
Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。
...た、Fiddle::Importer#[] で Fiddle::Function オブジェクトとして
取り出すことができます。
signature で関数の名前とシネグチャを指定します。例えば
"int compare(void*, void*)" のように指定します。
opts には :stdcall もしくは :cdecl を渡......関数を表す 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......e_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[data], 6, Fiddle::SIZEOF_IN... -
Exception2MessageMapper
# bind(cl) -> () (18202.0) -
@todo
...@todo
@param cl xxx... -
UnboundMethod
# bind _ call(recv , *args) -> object (12237.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 (12237.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... -
Binding
# local _ variable _ set(symbol , obj) (9131.0) -
引数 symbol で指定した名前のローカル変数に引数 obj を設定します。
...symbol で指定した名前のローカル変数に引数 obj を設定します。
@param symbol ローカル変数名を Symbol オブジェクトで指定します。
@param obj 引数 symbol で指定したローカル変数に設定するオブジェクトを指定します。
//emlist[例......f foo
a = 1
bind = binding
bind.local_variable_set(:a, 2) # set existing local variable `a'
bind.local_variable_set(:b, 3) # create new local variable `b'
# `b' exists only in binding
p bind.local_variable_get(:a) # => 2
p bind.local_variable_get(:b) #......# => NameError
end
//}
このメソッドは以下のコード(ただし、obj が Ruby のコードで出力される場
合)と同様の動作をします。
//emlist[][ruby]{
binding.eval("#{symbol} = #{obj}")
//}
@see Binding#local_variable_get, Binding#local_variable_defined?... -
Binding
# eval(expr , fname = _ _ FILE _ _ , lineno = 1) -> object (9101.0) -
自身をコンテキストとし文字列 expr を Ruby プログラムとして評価しその結果を返します。 組み込み関数 Kernel.#eval を使って eval(expr, self, fname, lineno) とするのと同じです。
...キストとし文字列 expr を
Ruby プログラムとして評価しその結果を返します。
組み込み関数 Kernel.#eval を使って
eval(expr, self, fname, lineno) とするのと同じです。
@param expr 評価したい式を文字列で与えます。
@param fname ファイル......aram lineno 行番号を整数で与えます。式 expr の先頭行の行番号が lineno であるかのように実行されます。
//emlist[例][ruby]{
def get_binding(str)
binding
end
str = "hello"
p eval("str + ' Fred'") #=> "hello Fred"
p get_binding("bye").eval("st......r + ' Fred'") #=> "bye Fred"
//}
@see Kernel.#eval... -
Binding
# local _ variable _ defined?(symbol) -> bool (9101.0) -
引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。
...symbol で指定した名前のローカル変数が定義されている場合に true を、
そうでない場合に false を返します。
@param symbol ローカル変数名を Symbol オブジェクトで指定します。
//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_defi......ned?(:a) # => true
binding.local_variable_defined?(:b) # => false
end
//}
このメソッドは以下のコードの短縮形です。
//emlist[][ruby]{
binding.eval("defined?(#{symbol}) == 'local-variable'")
//}
@see Binding#local_variable_get, Binding#local_variable_set... -
Binding
# local _ variable _ get(symbol) -> object (9101.0) -
引数 symbol で指定した名前のローカル変数に設定された値を返します。
...symbol で指定した名前のローカル変数に設定された値を返します。
@param symbol ローカル変数名を Symbol オブジェクトで指定します。
@raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。
//emlist[例][......ruby]{
def foo
a = 1
binding.local_variable_get(:a) # => 1
binding.local_variable_get(:b) # => NameError
end
//}
このメソッドは以下のコードの短縮形です。
//emlist[][ruby]{
binding.eval("#{symbol}")
//}
@see Binding#local_variable_set, Binding#local_variable_defined?... -
Binding
# local _ variables -> [Symbol] (9101.0) -
ローカル変数の一覧を Symbol の配列で返します。
...カル変数の一覧を Symbol の配列で返します。
//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}
このメソッドは以下のコードと同様の動作をします。
//emlist[][ruby]{
binding.eval("local_variables")
//}... -
Binding
# source _ location -> [String , Integer] (9101.0) -
self の Ruby のソースファイル名と行番号を返します。
...self の Ruby のソースファイル名と行番号を返します。
d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。
//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}... -
TracePoint
# binding -> Binding | nil (6301.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
... Binding オブジェクトを返します。
C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call)......do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}... -
ERB
# result(b=TOPLEVEL _ BINDING) -> String (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"
puts erb.result
# test foo
# test bar
//......}
@see ERB#result_with_hash...