Module: Functional::ClassMethods

Included in:
Method, Proc
Defined in:
lib/reducers/functional.rb

Instance Method Summary collapse

Instance Method Details

#compose(*proc_chain) ⇒ Object



10
11
12
13
# File 'lib/reducers/functional.rb', line 10

def compose(*proc_chain)
  proc_chain = proc_chain.first if proc_chain.first.class == Array
  proc_chain.reduce(->(x){x}){|result,p| result.compose(p)}
end