Class: Activite::Base
- Inherits:
-
Object
- Object
- Activite::Base
- Defined in:
- lib/activite/base.rb
Direct Known Subclasses
Activity, Measure, MeasurementGroup, Notification, SleepSeries, SleepSummary
Instance Attribute Summary collapse
- #attrs ⇒ Hash readonly
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Activite::Base
constructor
Initializes a new object with attributes for the values passed to the constructor.
Constructor Details
#initialize(attrs = {}) ⇒ Activite::Base
Initializes a new object with attributes for the values passed to the constructor.
10 11 12 13 14 15 16 |
# File 'lib/activite/base.rb', line 10 def initialize(attrs = {}) @attrs = attrs || {} @attrs.each do |key, value| self.class.class_eval { attr_reader key } instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#attrs ⇒ Hash (readonly)
4 5 6 |
# File 'lib/activite/base.rb', line 4 def attrs @attrs end |