別のキーワード
モジュール
- Kernel (61)
- ObjectSpace (12)
-
Process
:: GID (12) -
Process
:: UID (12) - Timeout (21)
検索結果
先頭5件
-
ObjectSpace
. # reachable _ objects _ from(obj) -> Array | nil (6126.0) -
obj から到達可能なすべてのオブジェクトを返します。マーク不能なオブジェ クトを指定した場合は nil を返します。本メソッドを使う事でメモリリークの 調査が行えます。
...クの
調査が行えます。
//emlist[例][ruby]{
# 配列クラス(Array)と 'a'、'b'、'c' に到達可能。
ObjectSpace.reachable_objects_from(['a', 'b', 'c'])
# => [Array, 'a', 'b', 'c']
//}
obj が 2 つ以上の同じオブジェクト x への参照を持つ場合、戻り値に含ま......ラス(Array)と v に到達可能。
ObjectSpace.reachable_objects_from([v = 'a', v, v])
# => [Array, 'a']
# 配列クラス(Array)と 3 つの異なる 'a' オブジェクトに到達可能。
ObjectSpace.reachable_objects_from(['a', 'a', 'a'])
# => [Array, 'a', 'a', 'a']
//}
obj にマーク不......loat オブジェクト))を指定した場合は
nil を返します。
//emlist[例][ruby]{
# 1 はマーク不能
ObjectSpace.reachable_objects_from(1)
# => nil
//}
obj が内部でオブジェクトへの参照を持つ場合、
ObjectSpace::InternalObjectWrapper オブジェクトが戻り値... -
Process
:: GID . # from _ name(name) -> Integer (6114.0) -
引数で指定した名前の実グループ ID を返します。
...引数で指定した名前の実グループ ID を返します。
Process::GID.from_name("wheel") # => 0
Process::GID.from_name("nosuchgroup") # => can't find group for nosuchgroup (ArgumentError)
@param name グループ名を指定します。
@raise ArgumentError 引数で指定した... -
Process
:: UID . # from _ name(name) -> Integer (6114.0) -
引数で指定した名前の実ユーザ ID を返します。
...引数で指定した名前の実ユーザ ID を返します。
Process::UID.from_name("root") # => 0
Process::UID.from_name("nosuchuser") # => can't find user for nosuchuser (ArgumentError)
@param name ユーザ名を指定します。
@raise ArgumentError 引数で指定したユーザが... -
Kernel
. # lambda -> Proc (61.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...:from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end
def test_block
tap { return :from_block }
return :from_method
end
p test_proc() #=> :from_proc
p test_lambda() #=> :from_method
p test_block() #=> :from_......るため、例外 LocalJumpError は発生しません。
//emlist[例][ruby]{
def foo
Proc.new { return }
end
foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェク... -
Kernel
. # lambda { . . . } -> Proc (61.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...:from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end
def test_block
tap { return :from_block }
return :from_method
end
p test_proc() #=> :from_proc
p test_lambda() #=> :from_method
p test_block() #=> :from_......るため、例外 LocalJumpError は発生しません。
//emlist[例][ruby]{
def foo
Proc.new { return }
end
foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェク... -
Kernel
. # proc -> Proc (61.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...:from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end
def test_block
tap { return :from_block }
return :from_method
end
p test_proc() #=> :from_proc
p test_lambda() #=> :from_method
p test_block() #=> :from_......るため、例外 LocalJumpError は発生しません。
//emlist[例][ruby]{
def foo
Proc.new { return }
end
foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェク... -
Kernel
. # proc { . . . } -> Proc (61.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...:from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end
def test_block
tap { return :from_block }
return :from_method
end
p test_proc() #=> :from_proc
p test_lambda() #=> :from_method
p test_block() #=> :from_......るため、例外 LocalJumpError は発生しません。
//emlist[例][ruby]{
def foo
Proc.new { return }
end
foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェク... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (13.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...g.org", [], 2, "210.251.121.214"]
0.689331
/usr/local/lib/ruby/1.6/timeout.rb:37: execution expired (Timeout::Error)
from -:6:in `timeout'
from -:6
# gethostbyname が0.1秒かからない場合は例外が発生しないので
# その場合は、t に小さい... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (13.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...g.org", [], 2, "210.251.121.214"]
0.689331
/usr/local/lib/ruby/1.6/timeout.rb:37: execution expired (Timeout::Error)
from -:6:in `timeout'
from -:6
# gethostbyname が0.1秒かからない場合は例外が発生しないので
# その場合は、t に小さい... -
Kernel
. # eval(expr) -> object (7.0) -
文字列 expr を Ruby プログラムとして評価してその結果を返しま す。第2引数に Binding オブジェクトを与えた場合、 そのオブジェクトを生成したコンテキストで文字列を評価します。
...val('a = RUBY_RELEASE_DATE')
p a #=> "2007-03-13"
eval('def fuga;p 777 end')
fuga #=> 777
eval('raise RuntimeError', binding, 'XXX.rb', 4)
#=> XXX.rb:4: RuntimeError (RuntimeError)
# from ..:9
//}
@see Kernel.#binding,Module#module_eval,BasicObject#instance_eval,Object#method,Object#send...