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