Class: Technologic::Event
- Inherits:
-
Object
- Object
- Technologic::Event
- Includes:
- ShortCircuIt
- Defined in:
- lib/technologic/event.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(name, started, finished, payload) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(name, started, finished, payload) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 |
# File 'lib/technologic/event.rb', line 9 def initialize(name, started, finished, payload) @name = name @duration = finished - started @payload = payload end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
7 8 9 |
# File 'lib/technologic/event.rb', line 7 def duration @duration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/technologic/event.rb', line 7 def name @name end |
Instance Method Details
#data ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/technologic/event.rb', line 15 def data {}.tap do |hash| hash.merge!(@payload) hash[:event] = name hash[:duration] = duration if duration.round > 0 end end |