Sha256: 401b15b8792d79c23b1099c0a8732996d7be746cc136c933f0f8a24ee149c51c

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

module Tanita
  module Api
    module Client
      class BaseEntity
        def initialize(property_values = {})
          @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 # rubocop:disable Security/Eval
          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.5.1 lib/tanita/api/client/base_entity.rb