Class: Scanii::TraceEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/scanii/trace_event.rb

Overview

A single processing event in a TraceResult.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timestamp:, message:) ⇒ TraceEvent

Returns a new instance of TraceEvent.



8
9
10
11
# File 'lib/scanii/trace_event.rb', line 8

def initialize(timestamp:, message:)
  @timestamp = timestamp
  @message   = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/scanii/trace_event.rb', line 6

def message
  @message
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'lib/scanii/trace_event.rb', line 6

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object



13
14
15
16
17
18
# File 'lib/scanii/trace_event.rb', line 13

def self.from_hash(hash)
  new(
    timestamp: hash["timestamp"]&.to_s,
    message: hash["message"]&.to_s
  )
end