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, it most often represents a single, countable metric.
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
Builds a new event.
- #to_json(*a) ⇒ Object
Methods included from Monitored
Constructor Details
#initialize(name, count = 1) ⇒ Event
Builds a new event
13 14 15 16 17 |
# File 'lib/hallmonitor/event.rb', line 13 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
19 20 21 22 23 24 25 |
# File 'lib/hallmonitor/event.rb', line 19 def to_json(*a) { name: @name, time: @time, count: @count }.to_json(*a) end |