Class: Haversine::Distance
- Inherits:
-
Object
- Object
- Haversine::Distance
- Defined in:
- lib/haversine.rb
Defined Under Namespace
Classes: Unit
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(distance) ⇒ Distance
constructor
A new instance of Distance.
Constructor Details
#initialize(distance) ⇒ Distance
Returns a new instance of Distance.
51 52 53 |
# File 'lib/haversine.rb', line 51 def initialize distance @distance = distance end |
Instance Attribute Details
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
49 50 51 |
# File 'lib/haversine.rb', line 49 def distance @distance end |
Instance Method Details
#[](key) ⇒ Object
55 56 57 58 59 |
# File 'lib/haversine.rb', line 55 def [] key method = :"delta_#{key}" raise ArgumentError, "Invalid unit key #{key}" if !respond_to? method Distance.send "in_#{key}", send(method) end |