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.



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/rflow/message.rb', line 150

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)


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

def completed_at
  @completed_at
end

#component_instance_uuidString (readonly)

The UUID of the component doing the processing.

Returns:

  • (String)


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

def component_instance_uuid
  @component_instance_uuid
end

#contextString

Arbitrary context bytes.

Returns:

  • (String)


148
149
150
# File 'lib/rflow/message.rb', line 148

def context
  @context
end

#started_atString (readonly)

The time processing started, in XML schema format.

Returns:

  • (String)


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

def started_at
  @started_at
end

Instance Method Details

#to_hashHash

Represent the processing event as a hash.

Returns:

  • (Hash)


165
166
167
168
169
170
171
172
# File 'lib/rflow/message.rb', line 165

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