Class: SimpleMetrics::DataPoint::Base
- Inherits:
-
Object
- Object
- SimpleMetrics::DataPoint::Base
- Defined in:
- lib/simple_metrics/data_point/base.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#sum ⇒ Object
Returns the value of attribute sum.
-
#total ⇒ Object
Returns the value of attribute total.
-
#ts ⇒ Object
Returns the value of attribute ts.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #attributes ⇒ Object
- #counter? ⇒ Boolean
- #event? ⇒ Boolean
- #gauge? ⇒ Boolean
-
#initialize(attributes) ⇒ Base
constructor
A new instance of Base.
- #timestamp ⇒ Object
- #timing? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 |
# File 'lib/simple_metrics/data_point/base.rb', line 9 def initialize(attributes) @id = attributes[:id] @name = attributes[:name] @value = attributes[:value] @ts = attributes[:ts] @sample_rate = attributes[:sample_rate] @sum = attributes[:sum] @total = attributes[:total] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/simple_metrics/data_point/base.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def name @name end |
#sum ⇒ Object
Returns the value of attribute sum.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def sum @sum end |
#total ⇒ Object
Returns the value of attribute total.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def total @total end |
#ts ⇒ Object
Returns the value of attribute ts.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def ts @ts end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def value @value end |
Instance Method Details
#attributes ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/simple_metrics/data_point/base.rb', line 43 def attributes { :name => @name, :value => @value, :ts => @ts, :type => @type, :total => @total, :sum => @sum } end |
#counter? ⇒ Boolean
19 20 21 |
# File 'lib/simple_metrics/data_point/base.rb', line 19 def counter? @type == 'c' end |
#event? ⇒ Boolean
31 32 33 |
# File 'lib/simple_metrics/data_point/base.rb', line 31 def event? @type == 'ev' end |
#gauge? ⇒ Boolean
23 24 25 |
# File 'lib/simple_metrics/data_point/base.rb', line 23 def gauge? @type == 'g' end |
#timestamp ⇒ Object
35 36 37 |
# File 'lib/simple_metrics/data_point/base.rb', line 35 def ts end |
#timing? ⇒ Boolean
27 28 29 |
# File 'lib/simple_metrics/data_point/base.rb', line 27 def timing? @type == 'ms' end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/simple_metrics/data_point/base.rb', line 54 def to_s attributes.to_s end |