Class: RFlow::Message::ProcessingEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rflow/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component_instance_uuid, started_at = nil, completed_at = nil, context = nil) ⇒ ProcessingEvent

Returns a new instance of ProcessingEvent.



106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/rflow/message.rb', line 106

def initialize(component_instance_uuid, started_at = nil, completed_at = nil, context = nil)
  @component_instance_uuid = component_instance_uuid
  @started_at = case started_at
                when String; Time.xmlschema(started_at)
                when Time; started_at
                else nil; end
  @completed_at = case completed_at
                  when String; Time.xmlschema(completed_at)
                  when Time; completed_at
                  else nil; end
  @context = context
end

Instance Attribute Details

#completed_atObject

Returns the value of attribute completed_at.



104
105
106
# File 'lib/rflow/message.rb', line 104

def completed_at
  @completed_at
end

#component_instance_uuidObject (readonly)

Returns the value of attribute component_instance_uuid.



103
104
105
# File 'lib/rflow/message.rb', line 103

def component_instance_uuid
  @component_instance_uuid
end

#contextObject

Returns the value of attribute context.



104
105
106
# File 'lib/rflow/message.rb', line 104

def context
  @context
end

#started_atObject (readonly)

Returns the value of attribute started_at.



103
104
105
# File 'lib/rflow/message.rb', line 103

def started_at
  @started_at
end

Instance Method Details

#to_hashObject



119
120
121
122
123
124
125
126
# File 'lib/rflow/message.rb', line 119

def to_hash
  {
    'component_instance_uuid' => component_instance_uuid.to_s,
    'started_at'   => started_at   ? started_at.xmlschema(6)   : nil,
    'completed_at' => completed_at ? completed_at.xmlschema(6) : nil,
    'context'      => context      ? context.to_s              : nil,
  }
end