class GarminConnect::Base::Hash

Public Instance Methods

display() click to toggle source
Calls superclass method
# File lib/garmin_connect/base.rb, line 104
def display
  self.fetch('display') { super }
end
key() click to toggle source

garmin data uses ‘display’ and ‘key’ as keys. this is why we can’t use Hashie as well

Calls superclass method
# File lib/garmin_connect/base.rb, line 101
def key
  self.fetch('key') { super }
end
method_missing(method, *args) click to toggle source
Calls superclass method
# File lib/garmin_connect/base.rb, line 107
def method_missing(method, *args)
  if args.size == 1 && method.to_s =~ /(.*)=$/ # ripped from hashie
    return self[$1.to_s] = args.first
  end
  obj = self[method.to_s]
  case obj
  when Base::Hash, Base::Array
    obj
  when Hash, Array
    self[method.to_s] = Base.generate(obj)
  when nil
    super(method, *args)
  else
    obj
  end
end