7件ヒット
[1-7件を表示]
(0.055秒)
別のキーワード
ライブラリ
- ビルトイン (7)
検索結果
-
Method
# >>(callable) -> Proc (48370.0) -
self と引数を合成した Proc を返します。
...し、
その戻り値を callable に渡して呼び出した結果を返します。
Method#<< とは呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end......3)
p (method(:f) >> method(:g)).call(3) # => 18
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = File.method(:read) >> WordSc......anner >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>...