Class: Barometer::Data::Vector

Inherits:
ConvertableUnits show all
Defined in:
lib/barometer/data/vector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ConvertableUnits

#<=>, #imperial, #initialize, #metric, #metric?

Constructor Details

This class inherits a constructor from Barometer::Data::ConvertableUnits

Instance Attribute Details

#bearingObject (readonly)

Returns the value of attribute bearing.



4
5
6
# File 'lib/barometer/data/vector.rb', line 4

def bearing
  @bearing
end

Instance Method Details

#kphObject



6
# File 'lib/barometer/data/vector.rb', line 6

def kph; metric; end

#mphObject



7
# File 'lib/barometer/data/vector.rb', line 7

def mph; imperial; end

#nil?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/barometer/data/vector.rb', line 17

def nil?
  super && bearing.nil?
end

#to_sObject



13
14
15
# File 'lib/barometer/data/vector.rb', line 13

def to_s
  [super, bearing_to_s].compact.join(' @ ')
end

#unitsObject



9
10
11
# File 'lib/barometer/data/vector.rb', line 9

def units
  metric? ? 'kph' : 'mph'
end