別のキーワード
ライブラリ
- ビルトイン (91)
-
shell
/ error (6) - socket (48)
モジュール
- Kernel (37)
-
Socket
:: Constants (24)
キーワード
- CantApplyMethod (6)
-
IFF
_ ISATAP (24) -
IFF
_ OVS _ DATAPATH (24) - Proc (12)
- lambda (18)
- proc (19)
-
rb
_ data _ object _ alloc (12) - then (14)
-
yield
_ self (16) - 手続きオブジェクトの挙動の詳細 (12)
検索結果
先頭5件
-
Kernel
. # proc -> Proc (6.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
..._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_block... -
Kernel
. # proc { . . . } -> Proc (6.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
..._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_block... -
Object
# then -> Enumerator (6.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# then {|x| . . . } -> object (6.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# yield _ self -> Enumerator (6.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# yield _ self {|x| . . . } -> object (6.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Proc (6.0)
-
ブロックをコンテキスト(ローカル変数のスコープやスタックフ レーム)とともにオブジェクト化した手続きオブジェクトです。
..._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_block... -
手続きオブジェクトの挙動の詳細 (6.0)
-
手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan
..._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_block...