Class: ActiveNutrition::Objects::Weights

Inherits:
Array
  • Object
show all
Defined in:
lib/active_nutrition/objects/weights.rb

Instance Method Summary collapse

Instance Method Details

#to_hash(options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/active_nutrition/objects/weights.rb', line 6

def to_hash(options = {})
  options[:by] ||= :measurement
  inject({}) do |ret, weight|
    ret[weight.send(options[:by])] = weight.grams
    ret
  end
end