るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. range end

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 >>

Binding#local_variable_defined?(symbol) -> bool (3007.0)

引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。

...a = 1
bind
ing.local_variable_defined?(:a) # => true
bind
ing.local_variable_defined?(:b) # => false
end

//}

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

//emlist[][ruby]{
bind
ing.eval("defined?(#{symbol}) == 'local-variable'")
//}

@see Binding#local_variable_get, Binding#loc...

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

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

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

//}

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

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

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

Module#instance_method(name) -> UnboundMethod (43.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...tance_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!
//}...

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

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

...性はありません。


@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....
...的な関連性はありません。


@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)...

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

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

...性はありません。


@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....
...的な関連性はありません。


@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)...

絞り込み条件を変える

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

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

...性はありません。


@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....
...的な関連性はありません。


@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)...

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

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

...性はありません。


@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....
...的な関連性はありません。


@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)...

UDPSocket#recvfrom_nonblock(maxlen, flags=0) -> [String, Array] (19.0)

ソケットをノンブロッキングモードに設定した後、 recvfrom(2) でソケットからデータを受け取ります。

...外には、IO::WaitReadable が extend
されています。

require 'socket'
s1 = UDPSocket.new
s1.bind("127.0.0.1", 0)
s2 = UDPSocket.new
s2.bind("127.0.0.1", 0)
s2.connect(*s1.addr.values_at(3,1))
s1.connect(*s2.addr.values_at(3,1))
s1.send "aaa", 0
begin # emulate blocking re...
...cvfrom
p s2.recvfrom_nonblock(10)
#=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
rescue IO::WaitReadable
IO.select([s2])
retry
end


@param maxlen 受け取るデータの最大バイト数
@param flags フラグ
@see IPSocket#recvfrom...
<< < 1 2 >>