Class: Mole::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/orwell/mole/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, details = {}) ⇒ Event

Returns a new instance of Event.



5
6
7
8
9
# File 'lib/orwell/mole/event.rb', line 5

def initialize(event, details = {})
  @event      = event
  @details    = details
  @timestamp  = Time.now.utc.to_i
end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



3
4
5
# File 'lib/orwell/mole/event.rb', line 3

def details
  @details
end

#eventObject

Returns the value of attribute event.



3
4
5
# File 'lib/orwell/mole/event.rb', line 3

def event
  @event
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/orwell/mole/event.rb', line 3

def timestamp
  @timestamp
end

Instance Method Details

#to_hObject



11
12
13
14
15
16
17
# File 'lib/orwell/mole/event.rb', line 11

def to_h
  {
    event:   event,
    details: details,
    timestamp: timestamp
  }
end