Class: Activite::Measure
Constant Summary collapse
- Weight =
Different measurement types
Class.new(self) do |cls| # Return weight measurement in kilograms (default unit) # # @return [Float] def in_kg @value end # Return weight measurement in pounds # # @return [Float] def in_lb (@value * 2.20462).round(3) end end
- Height =
Class.new(self)
- Pulse =
Class.new(self)
- FatFreeMass =
Class.new(Weight)
- FatMassWeight =
Class.new(Weight)
- FatRatio =
Class.new(self)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Activite::Measure
constructor
Create a new instance.
Constructor Details
#initialize(attrs = {}) ⇒ Activite::Measure
Create a new instance.
The Withings API returns all values as integers with a unit which represents the power of 10 the value should be multiplied by to get the real value. For example, value=20 and unit=-1 should be 2.0.
12 13 14 15 |
# File 'lib/activite/measures.rb', line 12 def initialize(attrs = {}) super(attrs) @value = value / (10 ** unit.abs).to_f end |