class RailwayOperation::Execution

This is intended to extend the functionality of a normal hash to make it easier to inspect the log

Public Class Methods

new(obj = []) click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 33
def initialize(obj = [])
  super
end

Public Instance Methods

<<(value) click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 37
def <<(value)
  super Step.new(value)
end
[]=(index, value) click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 41
def []=(index, value)
  super index, Step.new(value)
end
add_error(error) click to toggle source
# File lib/railway_operation/info.rb, line 53
def add_error(error)
  last.add_error(error)
end
add_step(argument:, track_identifier:, step_index:) click to toggle source
# File lib/railway_operation/info.rb, line 73
def add_step(argument:, track_identifier:, step_index:)
  self << {
    argument: argument,
    track_identifier: track_identifier,
    step_index: step_index
  }

  last
end
completed?() click to toggle source
# File lib/railway_operation/info.rb, line 69
def completed?
  all?(&:completed?)
end
display() click to toggle source
# File lib/railway_operation/info.rb, line 83
def display
  table = Terminal::Table.new
  table.title = 'Execution'
  table.headings = ['', 'Track', 'Success', 'Method', 'Errors']
  table.rows = self.map do |s|
    [
      s[:step_index],
      s[:track_identifier],
      s.success?,
      s[:noop] ? '--' : (s[:method].is_a?(Proc) ? 'Proc' : s[:method]),
      s[:errors]
    ]
  end

  table.to_s
end
errored?() click to toggle source
# File lib/railway_operation/info.rb, line 57
def errored?
  any?(&:errored?)
end
failed?() click to toggle source
# File lib/railway_operation/info.rb, line 65
def failed?
  !success?
end
first_step() click to toggle source
# File lib/railway_operation/info.rb, line 45
def first_step
  first
end
last_step() click to toggle source
# File lib/railway_operation/info.rb, line 49
def last_step
  last
end
new(maybe_obj) click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 29
def new(maybe_obj)
  maybe_obj.is_a?(Execution) ? maybe_obj : super
end
success?() click to toggle source
# File lib/railway_operation/info.rb, line 61
def success?
  all?(&:success?)
end