Class: RFlow::Message::ProcessingEvent

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

Overview

One processing event in the message’s provenance.

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.



146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/rflow/message.rb', line 146

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_atString

The time processing ended, in XML schema format.

Returns:

  • (String)


141
142
143
# File 'lib/rflow/message.rb', line 141

def completed_at
  @completed_at
end

#component_instance_uuidString (readonly)

The UUID of the component doing the processing.

Returns:

  • (String)


135
136
137
# File 'lib/rflow/message.rb', line 135

def component_instance_uuid
  @component_instance_uuid
end

#contextString

Arbitrary context bytes.

Returns:

  • (String)


144
145
146
# File 'lib/rflow/message.rb', line 144

def context
  @context
end

#started_atString (readonly)

The time processing started, in XML schema format.

Returns:

  • (String)


138
139
140
# File 'lib/rflow/message.rb', line 138

def started_at
  @started_at
end

Instance Method Details

#to_hashHash

Represent the processing event as a hash.

Returns:

  • (Hash)


161
162
163
164
165
166
167
168
# File 'lib/rflow/message.rb', line 161

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