Class: Orchestra::Event
- Inherits:
-
Object
- Object
- Orchestra::Event
- Defined in:
- lib/orchestra/event.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #finish! ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(name, parent = nil, payload = nil) ⇒ Event
constructor
A new instance of Event.
- #parent? ⇒ Boolean
- #payload? ⇒ Boolean
Constructor Details
#initialize(name, parent = nil, payload = nil) ⇒ Event
Returns a new instance of Event.
5 6 7 8 9 10 11 |
# File 'lib/orchestra/event.rb', line 5 def initialize(name, parent=nil, payload=nil) @name = name @time = Time.now.utc @thread_id = Thread.current.object_id @parent = parent @payload = payload || [] end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def duration @duration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def parent @parent end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def payload @payload end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def thread_id @thread_id end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/orchestra/event.rb', line 3 def time @time end |
Instance Method Details
#finish! ⇒ Object
13 14 15 |
# File 'lib/orchestra/event.rb', line 13 def finish! @duration = Time.now.utc - @time end |
#finished? ⇒ Boolean
17 18 19 |
# File 'lib/orchestra/event.rb', line 17 def finished? !!@duration end |
#parent? ⇒ Boolean
21 22 23 |
# File 'lib/orchestra/event.rb', line 21 def parent? !!@parent end |
#payload? ⇒ Boolean
25 26 27 |
# File 'lib/orchestra/event.rb', line 25 def payload? !@payload.empty? end |