Class: TableStructure::Utils::CompositeCallable

Inherits:
Object
  • Object
show all
Defined in:
lib/table_structure/utils.rb

Instance Method Summary collapse

Constructor Details

#initializeCompositeCallable

Returns a new instance of CompositeCallable.



26
27
28
# File 'lib/table_structure/utils.rb', line 26

def initialize
  @callables = []
end

Instance Method Details

#call(source) ⇒ Object



35
36
37
# File 'lib/table_structure/utils.rb', line 35

def call(source)
  @callables.reduce(source) { |memo, callable| callable.call(memo) }
end

#compose(*callables) ⇒ Object



30
31
32
33
# File 'lib/table_structure/utils.rb', line 30

def compose(*callables)
  @callables.concat(callables.flatten.compact)
  self
end