Module: Lab42::Behavior::Composer

Extended by:
Composer
Included in:
Composer
Defined in:
lib/lab42/core/behavior/composition.rb

Instance Method Summary collapse

Instance Method Details

#arg_passing_composition(lhs, rhs) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/lab42/core/behavior/composition.rb', line 11

def arg_passing_composition lhs, rhs
  Lab42::Behavior::ProcBehavior.new do |*args, &blk|
    rhs
    .( lhs
      .( *args, &blk ) )
  end
end

#zero_arity_composition(lhs, rhs) ⇒ Object



5
6
7
8
9
10
# File 'lib/lab42/core/behavior/composition.rb', line 5

def zero_arity_composition lhs, rhs
  Lab42::Behavior::ProcBehavior.new do |*args, &blk|
    lhs.( *args, &blk )
    rhs.()
  end
end