Class: Dynflow::ExecutionHistory
- Inherits:
- 
      Object
      
        - Object
- Dynflow::ExecutionHistory
 
- Includes:
- Algebrick::TypeCheck, Enumerable
- Defined in:
- lib/dynflow/execution_history.rb
Defined Under Namespace
Modules: Event
Instance Attribute Summary collapse
- 
  
    
      #events  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute events. 
Class Method Summary collapse
Instance Method Summary collapse
- #add(name, world_id = nil) ⇒ Object
- #each(&block) ⇒ Object
- 
  
    
      #initialize(events = [])  ⇒ ExecutionHistory 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ExecutionHistory. 
- #inspect ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(events = []) ⇒ ExecutionHistory
Returns a new instance of ExecutionHistory.
| 22 23 24 | # File 'lib/dynflow/execution_history.rb', line 22 def initialize(events = []) @events = (events || []).each { |e| Type! e, Event } end | 
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
| 20 21 22 | # File 'lib/dynflow/execution_history.rb', line 20 def events @events end | 
Class Method Details
.new_from_hash(value) ⇒ Object
| 42 43 44 45 46 | # File 'lib/dynflow/execution_history.rb', line 42 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 | 
Instance Method Details
#add(name, world_id = nil) ⇒ Object
| 30 31 32 | # File 'lib/dynflow/execution_history.rb', line 30 def add(name, world_id = nil) @events << Event[Time.now.to_i, name, world_id] end | 
#each(&block) ⇒ Object
| 26 27 28 | # File 'lib/dynflow/execution_history.rb', line 26 def each(&block) @events.each(&block) end | 
#inspect ⇒ Object
| 38 39 40 | # File 'lib/dynflow/execution_history.rb', line 38 def inspect "ExecutionHistory: #{@events.inspect}" end | 
#to_hash ⇒ Object
| 34 35 36 | # File 'lib/dynflow/execution_history.rb', line 34 def to_hash @events.map(&:to_hash) end |