# File lib/dynflow/execution_history.rb, line 20 def initialize(events = []) @events = (events || []).each { |e| Type! e, Event } end
# File lib/dynflow/execution_history.rb, line 40 def self.new_from_hash(value) value ||= [] # for compatibility with tasks before the # introduction of execution history self.new(value.map { |hash| Event[hash] }) end
# File lib/dynflow/execution_history.rb, line 28 def add(name, world_id = nil) @events << Event[Time.now.to_i, name, world_id] end
# File lib/dynflow/execution_history.rb, line 24 def each(&block) @events.each(&block) end
# File lib/dynflow/execution_history.rb, line 36 def inspect "ExecutionHistory: #{ @events.inspect }" end
# File lib/dynflow/execution_history.rb, line 32 def to_hash @events.map(&:to_hash) end