Module: TiltHydrometer::BeaconDecorator
- Defined in:
- lib/tilt_hydrometer/beacon_decorator.rb
Instance Method Summary collapse
- #celsius ⇒ Object
- #color ⇒ Object
- #gravity ⇒ Object
- #log ⇒ Object
- #plato ⇒ Object
- #temp ⇒ Object
- #values_out_of_range? ⇒ Boolean
Instance Method Details
#celsius ⇒ Object
28 29 30 31 32 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 28 def celsius ( (temp - 32.0) * (5.0 / 9.0) ).round(1) end |
#color ⇒ Object
5 6 7 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 5 def color TiltHydrometer::DEVICES[uuid] end |
#gravity ⇒ Object
13 14 15 16 17 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 13 def gravity gravity_string = data[1].to_s "#{gravity_string[-4] || 0}.#{gravity_string[-3..-1]}".to_f end |
#log ⇒ Object
38 39 40 41 42 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 38 def log LOGGER.debug("Beacon: #{inspect}") LOGGER.debug("Data: #{data.inspect}") LOGGER.debug("UUID: #{uuid.inspect}") end |
#plato ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 19 def plato ( (-1 * 616.868) + (1111.14 * gravity) - (630.272 * (gravity**2)) + (135.997 * (gravity**3)) ).round(1) end |
#temp ⇒ Object
9 10 11 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 9 def temp data[0].to_i end |
#values_out_of_range? ⇒ Boolean
34 35 36 |
# File 'lib/tilt_hydrometer/beacon_decorator.rb', line 34 def values_out_of_range? temp > 212 end |