Class: TotenDev::Metric
- Inherits:
-
Object
- Object
- TotenDev::Metric
- Defined in:
- lib/tdev_metrics/metric.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#info ⇒ Object
Returns the value of attribute info.
-
#name ⇒ Object
Returns the value of attribute name.
-
#place ⇒ Object
Returns the value of attribute place.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(hash = nil) ⇒ Metric
constructor
A new instance of Metric.
- #to_hash ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ Metric
Returns a new instance of Metric.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tdev_metrics/metric.rb', line 16 def initialize( hash = nil ) if hash.nil? = Time.now.getutc.to_i else @id = hash['id'].to_i @name = hash['metric'] @project_id = hash['project'].to_i @place = hash['place'] @type = hash['type'] @info = hash['info'] = hash['timestamp'].to_i end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/tdev_metrics/metric.rb', line 8 def id @id end |
#info ⇒ Object
Returns the value of attribute info.
13 14 15 |
# File 'lib/tdev_metrics/metric.rb', line 13 def info @info end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/tdev_metrics/metric.rb', line 9 def name @name end |
#place ⇒ Object
Returns the value of attribute place.
11 12 13 |
# File 'lib/tdev_metrics/metric.rb', line 11 def place @place end |
#project_id ⇒ Object
Returns the value of attribute project_id.
10 11 12 |
# File 'lib/tdev_metrics/metric.rb', line 10 def project_id @project_id end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
14 15 16 |
# File 'lib/tdev_metrics/metric.rb', line 14 def end |
#type ⇒ Object
Returns the value of attribute type.
12 13 14 |
# File 'lib/tdev_metrics/metric.rb', line 12 def type @type end |
Instance Method Details
#to_hash ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/tdev_metrics/metric.rb', line 30 def to_hash { 'metric' => @name, 'project' => @project_id, 'place' => @place, 'type' => @type, 'info' => @info, 'timestamp' => } end |