class RailwayOperation::Step
Public Class Methods
new(obj = {})
click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 106 def initialize(obj = {}) super end
Public Instance Methods
add_error(error)
click to toggle source
# File lib/railway_operation/info.rb, line 160 def add_error(error) errors << error if error end
completed?()
click to toggle source
# File lib/railway_operation/info.rb, line 126 def completed? started? && self[:ended_at] end
completed_at()
click to toggle source
# File lib/railway_operation/info.rb, line 118 def completed_at ended_at end
end!()
click to toggle source
# File lib/railway_operation/info.rb, line 150 def end! raise 'cannot complete step that has not yet started' unless started? self[:ended_at] = timestamp end
ended_at()
click to toggle source
# File lib/railway_operation/info.rb, line 114 def ended_at self[:ended_at] end
errored?()
click to toggle source
# File lib/railway_operation/info.rb, line 134 def errored? !errors.empty? end
errors()
click to toggle source
# File lib/railway_operation/info.rb, line 170 def errors self[:errors] ||= [] self[:errors] end
fail!(error)
click to toggle source
# File lib/railway_operation/info.rb, line 155 def fail!(error) self[:failed_at] = timestamp add_error(error) end
failed?()
click to toggle source
# File lib/railway_operation/info.rb, line 138 def failed? !!self[:failed] end
new(maybe_obj)
click to toggle source
Calls superclass method
# File lib/railway_operation/info.rb, line 102 def new(maybe_obj) maybe_obj.is_a?(Step) ? maybe_obj : super end
noop!()
click to toggle source
# File lib/railway_operation/info.rb, line 164 def noop! self[:started_at] = self[:ended_at] = timestamp self[:method] = nil self[:noop] = true end
noop?()
click to toggle source
# File lib/railway_operation/info.rb, line 142 def noop? self[:noop] end
start!()
click to toggle source
# File lib/railway_operation/info.rb, line 146 def start! self[:started_at] = timestamp end
started?()
click to toggle source
# File lib/railway_operation/info.rb, line 122 def started? self[:started_at] end
started_at()
click to toggle source
# File lib/railway_operation/info.rb, line 110 def started_at self[:started_at] end
step_index()
click to toggle source
# File lib/railway_operation/info.rb, line 179 def step_index self[:step_index] end
success?()
click to toggle source
# File lib/railway_operation/info.rb, line 130 def success? errors.empty? && !self[:failed] end
timestamp()
click to toggle source
# File lib/railway_operation/info.rb, line 183 def timestamp Time.respond_to?(:current) ? Time.current : Time.now end
track_identifier()
click to toggle source
# File lib/railway_operation/info.rb, line 175 def track_identifier self[:track_identifier] end