class Alchemist::Earth
Constants
- RADIUS
Attributes
base[R]
measurement[R]
Public Class Methods
new(measurement)
click to toggle source
# File lib/alchemist/objects/planets/earth.rb, line 5 def initialize measurement @measurement = measurement end
Public Instance Methods
geospatial()
click to toggle source
# File lib/alchemist/objects/planets/earth.rb, line 9 def geospatial if types.include?(:angles) geospatial_angle_to_arc elsif types.include?(:distance) geospatial_arc_to_angle else raise GeospatialArgumentError, "geospatial must either be angles or distance" end end
Private Instance Methods
geospatial_angle_to_arc()
click to toggle source
# File lib/alchemist/objects/planets/earth.rb, line 26 def geospatial_angle_to_arc measurement.to(:radians).to_f * RADIUS end
geospatial_arc_to_angle()
click to toggle source
# File lib/alchemist/objects/planets/earth.rb, line 30 def geospatial_arc_to_angle Alchemist.measure(measurement.to(:meters) / RADIUS, :radians) end
types()
click to toggle source
# File lib/alchemist/objects/planets/earth.rb, line 22 def types measurement.types end