Class: Papertrail::Event
- Inherits:
-
Object
- Object
- Papertrail::Event
- Defined in:
- lib/papertrail/event.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Event
constructor
A new instance of Event.
- #received_at ⇒ Object
- #to_s ⇒ Object
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
#data ⇒ Object (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_at ⇒ Object
11 12 13 |
# File 'lib/papertrail/event.rb', line 11 def received_at @received_at ||= Time.parse(data['received_at']) end |
#to_s ⇒ Object
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 |