Sha256: c8637adc06ef0e1b5498af2cf6f784eaf68b3cec9b63ebafc7c522cc9cfff344

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

module Tanita
  module Api
    module Client
      class BaseEntity
        def initialize(property_values = {})
          @properties = []
          @cached_property_values = {}
          @cached_property_values.merge!(property_values)
        end

        def to_h
          ret = {}
          self.class.properties.each do |property|
            ret[property.to_sym] = eval property.to_s
          end
          ret
        end

        def inspect
          "\#<#{self.class}:#{object_id} properties=#{self.class.properties.join(',')}>"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tanita-api-client-0.3.0 lib/tanita/api/client/base_entity.rb