Class: Conductor::Worker::Events::ConductorEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/worker/events/conductor_event.rb

Overview

Base class for all Conductor events Provides a timestamp for when the event occurred

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConductorEvent

Returns a new instance of ConductorEvent.



12
13
14
# File 'lib/conductor/worker/events/conductor_event.rb', line 12

def initialize
  @timestamp = Time.now.utc
end

Instance Attribute Details

#timestampTime (readonly)

Returns UTC timestamp when event was created.

Returns:

  • (Time)

    UTC timestamp when event was created



10
11
12
# File 'lib/conductor/worker/events/conductor_event.rb', line 10

def timestamp
  @timestamp
end

Instance Method Details

#to_hHash

Returns Event as a hash for serialization.

Returns:

  • (Hash)

    Event as a hash for serialization



17
18
19
# File 'lib/conductor/worker/events/conductor_event.rb', line 17

def to_h
  { timestamp: @timestamp.iso8601(3) }
end