Class: Tanita::Api::Client::BaseEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/tanita/api/client/base_entity.rb

Instance Method Summary collapse

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

#inspectObject



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_hObject



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