るりまサーチ

最速Rubyリファレンスマニュアル検索!
108件ヒット [1-100件を表示] (0.198秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Fiddle::Importer#bind(signature, *opts) { ... } -> Fiddle::Function (24376.0)

Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。

...Ruby のブロックを C の関数で wrap し、その関数をモジュールに
インポートします。

これでインポートされた関数はモジュール関数として定義されます。
また、Fiddle::Importer#[] で Fiddle::Function オブジェクトとして
取り出す...
...きます。

signature で関数の名前とシネグチャを指定します。例えば
"int compare(void*, void*)" のように指定します。

opts には :stdcall もしくは :cdecl を渡すことができ、
呼出規約を明示することができます。

@
return インポートし...
...Function オブジェクトを返します。

@
param signature 関数の名前とシネグチャ
@
param opts オプション


r
equire 'fiddle/import'

module M
extend Fiddle::Importer
dlload "libc.so.6"
t
ypealias "size_t", "unsigned long"
extern "int qsort(void*, size_t, s...

Binding#local_variable_set(symbol, obj) (15285.0)

引数 symbol で指定した名前のローカル変数に引数 obj を設定します。

...

@
param symbol ローカル変数名を Symbol オブジェクトで指定します。

@
param obj 引数 symbol で指定したローカル変数に設定するオブジェクトを指定します。

//emlist[例][ruby]{
def foo
a = 1
bind
= binding
bind
.local_variable_set(:a, 2) # set e...
...xisting 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) # => 3
p a # => 2
p b...
...# => NameError
end
//}

このメソッドは以下のコード(ただし、obj が Ruby のコードで出力される場
合)と同様の動作をします。

//emlist[][ruby]{
bind
ing.eval("#{symbol} = #{obj}")
//}

@
see Binding#local_variable_get, Binding#local_variable_defined?...

Binding#local_variable_get(symbol) -> object (15243.0)

引数 symbol で指定した名前のローカル変数に設定された値を返します。

...

@
param symbol ローカル変数名を Symbol オブジェクトで指定します。

@
raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。

//emlist[例][ruby]{
def foo
a = 1
bind
ing.local_variable_get(:a) # => 1
bind
ing.local_variabl...
...e_get(:b) # => NameError
end
//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
bind
ing.eval("#{symbol}")
//}

@
see Binding#local_variable_set, Binding#local_variable_defined?...

ERB#result(b=TOPLEVEL_BINDING) -> String (12325.0)

ERB を b の binding で実行し、結果の文字列を返します。

...ERB を b の binding で実行し、結果の文字列を返します。

@
param b eRubyスクリプトが実行されるときのbinding

//emlist[例][ruby]{
r
equire 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
t
est1 = "foo"
t
est2 = "bar"
puts erb.result
# test foo
# test bar
//...
...}

@see ERB#result_with_hash...

UnboundMethod#bind_call(recv, *args) -> object (9355.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 (9355.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...

ERB#run(b=TOPLEVEL_BINDING) -> nil (6319.0)

ERB を b の binding で実行し、結果を標準出力へ印字します。

...ERB を b の binding で実行し、結果を標準出力へ印字します。

@
param b eRubyスクリプトが実行されるときのbinding

//emlist[例][ruby]{
r
equire 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
t
est1 = "foo"
t
est2 = "bar"
erb.run
# test foo
# test bar
//}...

Binding#eval(expr, fname = __FILE__, lineno = 1) -> object (3269.0)

自身をコンテキストとし文字列 expr を Ruby プログラムとして評価しその結果を返します。 組み込み関数 Kernel.#eval を使って eval(expr, self, fname, lineno) とするのと同じです。

...ストとし文字列 expr
Ruby
プログラムとして評価しその結果を返します。
組み込み関数 Kernel.#eval を使って
eval(expr, self, fname, lineno) とするのと同じです。

@
param expr 評価したい式を文字列で与えます。

@
param fname ファイル名...
...式 expr が fname というファイル名にあるかのように実行されます。

@
param lineno 行番号を整数で与えます。式 expr の先頭行の行番号が lineno であるかのように実行されます。

//emlist[例][ruby]{
def get_binding(str)
bind
ing
end
str = "hello"...
...p eval("str + ' Fred'") #=> "hello Fred"
p get_binding("bye").eval("str + ' Fred'") #=> "bye Fred"
//}

@
see Kernel.#eval...

Method#===(*args) -> object (3237.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

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

m = Foo.new.method(:...
...foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

Method#[](*args) -> object (3237.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

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

m = Foo.new.method(:...
...foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

絞り込み条件を変える

Method#call(*args) -> object (3237.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

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

m = Foo.new.method(:...
...foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

Method#call(*args) { ... } -> object (3237.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

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

m = Foo.new.method(:...
...foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

Method#===(*args) -> object (3231.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call

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

m = Foo.new.method(:foo) # => #<Method:...
...Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

Method#[](*args) -> object (3231.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call

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

m = Foo.new.method(:foo) # => #<Method:...
...Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...
<< 1 2 > >>