Class: AreWeThereYet::Metric
- Inherits:
-
Object
- Object
- AreWeThereYet::Metric
- Defined in:
- lib/are_we_there_yet/metric.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#run_id ⇒ Object
readonly
Returns the value of attribute run_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Metric
constructor
A new instance of Metric.
-
#save(datastore) ⇒ Object
Only works for creates not for updates - will need to be cleverer if we ever need to provide for updates.
Constructor Details
#initialize(options = {}) ⇒ Metric
Returns a new instance of Metric.
4 5 6 7 8 9 10 |
# File 'lib/are_we_there_yet/metric.rb', line 4 def initialize(={}) @id = [:id] @execution_time = [:execution_time] @path = [:path] @run_id = [:run_id] @description = [:description] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/are_we_there_yet/metric.rb', line 3 def description @description end |
#execution_time ⇒ Object (readonly)
Returns the value of attribute execution_time.
3 4 5 |
# File 'lib/are_we_there_yet/metric.rb', line 3 def execution_time @execution_time end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/are_we_there_yet/metric.rb', line 3 def id @id end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/are_we_there_yet/metric.rb', line 3 def path @path end |
#run_id ⇒ Object (readonly)
Returns the value of attribute run_id.
3 4 5 |
# File 'lib/are_we_there_yet/metric.rb', line 3 def run_id @run_id end |
Class Method Details
.all(datastore) ⇒ Object
17 18 19 |
# File 'lib/are_we_there_yet/metric.rb', line 17 def self.all(datastore) datastore[:metrics].all.map { |record| new record } end |
Instance Method Details
#save(datastore) ⇒ Object
Only works for creates not for updates - will need to be cleverer if we ever need to provide for updates
13 14 15 |
# File 'lib/are_we_there_yet/metric.rb', line 13 def save(datastore) @id = datastore[:metrics].insert(to_h.merge(:created_at => Time.now.utc)) end |