Class: SimpleMetrics::Instrument
- Inherits:
-
Object
- Object
- SimpleMetrics::Instrument
- Defined in:
- lib/simple_metrics/instrument.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#name ⇒ Object
Returns the value of attribute name.
-
#renderer ⇒ Object
Returns the value of attribute renderer.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attributes) ⇒ Instrument
constructor
A new instance of Instrument.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Instrument
6 7 8 9 10 11 12 13 |
# File 'lib/simple_metrics/instrument.rb', line 6 def initialize(attributes) @id = attributes[:id] @name = attributes[:name] @renderer = attributes[:renderer] || 'line' @created_at = attributes[:created_at] @updated_at = attributes[:updated_at] @metrics = attributes[:metrics] || [] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def id @id end |
#metrics ⇒ Object
Returns the value of attribute metrics.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def metrics @metrics end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def name @name end |
#renderer ⇒ Object
Returns the value of attribute renderer.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def renderer @renderer end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/simple_metrics/instrument.rb', line 4 def updated_at @updated_at end |
Instance Method Details
#attributes ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/simple_metrics/instrument.rb', line 15 def attributes { :id => @id.to_s, # convert bson id to str :name => @name, :renderer => @renderer, :metrics => @metrics, :created_at => @created_at, :updated_at => @updated_at } end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/simple_metrics/instrument.rb', line 26 def to_s attributes.to_s end |