Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Method#>>

(::Proc::_Callable g) -> ::Proc
self >> g → a_proc

Returns a proc that is the composition of this method and the given g.

The returned proc takes a variable number of arguments. It first calls self with the arguments, then calls g with the return value of self.

Example
def f(ary) = ary << 'in f'

f = self.method(:f)
g = proc { |ary| ary << 'in proc' }
(f >> g).call([]) # => ["in f", "in proc"]
See also #=== #[] #== #arity also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0