Module: Gemmy::Patches::ProcPatch::InstanceMethods::Compose

Defined in:
lib/gemmy/patches/proc_patch.rb

Instance Method Summary collapse

Instance Method Details

#compose(g) ⇒ Object

a.compose(b).call(4) #=> 6 b.compose(a).call(4) #=> 4

Raises:

  • (ArgumentError)


77
78
79
80
# File 'lib/gemmy/patches/proc_patch.rb', line 77

def compose(g)
  raise ArgumentError, "arity count mismatch" unless arity == g.arity
  lambda{ |*a| self[ *g[*a] ] }
end