Class: Tanita::Api::Client::BaseEntity
- Inherits:
-
Object
- Object
- Tanita::Api::Client::BaseEntity
- Defined in:
- lib/tanita/api/client/base_entity.rb
Instance Method Summary collapse
-
#initialize(property_values = {}) ⇒ BaseEntity
constructor
A new instance of BaseEntity.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(property_values = {}) ⇒ BaseEntity
Returns a new instance of BaseEntity.
7 8 9 10 |
# File 'lib/tanita/api/client/base_entity.rb', line 7 def initialize(property_values = {}) @cached_property_values = {} @cached_property_values.merge!(property_values) end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/tanita/api/client/base_entity.rb', line 20 def inspect "\#<#{self.class}:#{object_id} properties=#{self.class.properties.join(',')}>" end |
#to_h ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/tanita/api/client/base_entity.rb', line 12 def to_h ret = {} self.class.properties.each do |property| ret[property.to_sym] = eval property.to_s # rubocop:disable Security/Eval end ret end |