Class: Hallmonitor::Event
- Inherits:
-
Object
- Object
- Hallmonitor::Event
- Includes:
- Monitored
- Defined in:
- lib/hallmonitor/event.rb
Overview
The event class is a single-fire event
Direct Known Subclasses
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(name, count = 1) ⇒ Event
constructor
A new instance of Event.
- #to_json(*a) ⇒ Object
Methods included from Monitored
Constructor Details
#initialize(name, count = 1) ⇒ Event
Returns a new instance of Event.
10 11 12 13 14 |
# File 'lib/hallmonitor/event.rb', line 10 def initialize(name, count=1) @name = name @time = Time.now @count = count end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def count @count end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def name @name end |
#time ⇒ Object
Returns the value of attribute time.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def time @time end |
Instance Method Details
#to_json(*a) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/hallmonitor/event.rb', line 16 def to_json(*a) { name: @name, time: @time, count: @count }.to_json(*a) end |