Class: FeatureEnvy::Operation::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_envy/operation.rb

Instance Method Summary collapse

Constructor Details

#initialize(first, second) ⇒ Pipeline

Returns a new instance of Pipeline.



17
18
19
20
21
22
# File 'lib/feature_envy/operation.rb', line 17

def initialize first, second
  first_operations = first.is_a?(Pipeline) ? first.operations : [first]
  second_operations = second.is_a?(Pipeline) ? second.operations : [second]

  @operations = first_operations + second_operations
end

Instance Method Details

#call(value) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/feature_envy/operation.rb', line 24

def call value
  @operations.each do |operation|
    value = operation.call value
  end

  value
end

#inspectObject



32
33
34
# File 'lib/feature_envy/operation.rb', line 32

def inspect
  @operations.map(&:inspect).join " >> "
end