Module: Teckel::Chain::ClassMethods

Defined in:
lib/teckel/chain.rb

Instance Method Summary collapse

Instance Method Details

#call(input) ⇒ Object



152
153
154
# File 'lib/teckel/chain.rb', line 152

def call(input)
  new.call!(@steps, input)
end

#errorsObject



145
146
147
148
149
150
# File 'lib/teckel/chain.rb', line 145

def errors
  @steps.each_with_object([]) do |e, m|
    err = e.last&.error
    m << err if err
  end
end

#inputObject



137
138
139
# File 'lib/teckel/chain.rb', line 137

def input
  @steps.first&.last&.input
end

#outputObject



141
142
143
# File 'lib/teckel/chain.rb', line 141

def output
  @steps.last&.last&.output
end

#step(name, operation) ⇒ Object



156
157
158
# File 'lib/teckel/chain.rb', line 156

def step(name, operation)
  @steps << [name, operation]
end