Class: Papertrail::Event

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Event

Returns a new instance of Event.



7
8
9
# File 'lib/papertrail/event.rb', line 7

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/papertrail/event.rb', line 5

def data
  @data
end

Instance Method Details

#received_atObject



11
12
13
# File 'lib/papertrail/event.rb', line 11

def received_at
  @received_at ||= Time.parse(data['received_at'])
end

#to_sObject



15
16
17
# File 'lib/papertrail/event.rb', line 15

def to_s
  "#{received_at.strftime('%b %d %X')} #{data['hostname']} #{data['program']}: #{data['message']}"
end