class

Haversine::Distance

Inherits Comparable / Reference / Object

Constructors

new(distance : Number)
Source

Instance methods

<=>(other : Haversine::Distance)

The comparison operator. Returns 0 if the two objects are equal, a negative number if this object is considered less than other, a positive number if this object is considered greater than other, or nil if the two objects are not comparable.

Subclasses define this method to provide class-specific ordering.

The comparison operator is usually used to sort values:

# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]

# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
Source
distance
Source
distance=(distance : Float32 | Float64 | Int32)
Source
to_centimeters
Source
to_centimetres
Source
to_degrees
Source
to_feet
Source
to_inches
Source
to_kilometers
Source
to_kilometres
Source
to_meters
Source
to_metres
Source
to_miles
Source
to_millimeters
Source
to_millimetres
Source
to_nautical_miles
Source
to_radians
Source
to_yards
Source