るりまサーチ

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.033秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:>>[x] > クラス:Method[x]

別のキーワード

  1. _builtin >>
  2. date >>
  3. ipaddr >>
  4. bn >>
  5. status >>

検索結果

Method#>>(callable) -> Proc (18121.0)

self と引数を合成した Proc を返します。

...ます。

Method
#<< とは呼び出しの順序が逆になります。

@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。

//emlist[例][ruby]{
def f(x)
x * x
end

def g(x)
x + x
end

# (3 * 3) + (3 * 3)
p (method(:f) >> method(:g)).call(3...
...uby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = File.method(:read) >> WordScanner >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@see Proc#<<, Proc#>>...