Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
Overview
A number of methods have been added to the Ruby Numeric class to do units conversions.
Instance Method Summary # collapse
-
#cm ⇒ Length
The cm method is used to convert from centimeters to inches.
-
#degrees ⇒ Float
The degrees method is used to convert from degrees to radians.
-
#feet ⇒ Length
The feet method is used to convert from feet to inches.
-
#inch ⇒ Length
The to_l is used to convert from a number to a length.
-
#km ⇒ Length
The km method is used to convert from kilometers to inches.
-
#m ⇒ Length
The m method is used to convert from meters to inches.
-
#mile ⇒ Length
The mile method is used to convert from miles to inches.
-
#mm ⇒ Length
The mm method is used to convert from millimeters to inches.
-
#radians ⇒ Float
The radians method is used to convert from radians to degrees.
-
#to_cm ⇒ Float
The to_cm method is used to convert from inches to centimeters.
-
#to_feet ⇒ Float
The to_feet method is used to convert from inches to feet.
-
#to_inch ⇒ Float
The to_inch method converts from inches to inches.
-
#to_km ⇒ Float
The to_km method is used to convert from inches to kilometers.
-
#to_l ⇒ Length
The to_l is used to convert from a number to a length.
-
#to_m ⇒ Float
The to_m method is used to convert from inches to meters.
-
#to_mile ⇒ Float
The to_mile method is used to convert from inches to miles.
-
#to_mm ⇒ Float
The to_mm method is used to convert from inches to millimeters.
-
#to_yard ⇒ Float
The to_yard method is used to convert from inches to yards.
-
#yard ⇒ Length
The yard method is used to convert from yards to inches.
Instance Method Details
↑ #degrees ⇒ Float
The degrees method is used to convert from degrees to radians.
For example 90.degrees would return 1.5707963267949
↑ #mm ⇒ Length
The mm method is used to convert from millimeters to inches.
It returns a Length value which is the same length as the given value. For example len = 25.4.mm returns 1 inch.
↑ #radians ⇒ Float
The radians method is used to convert from radians to degrees.
For example, 1.5707963267949.radians would return 90.0
↑ #to_cm ⇒ Float
The to_cm method is used to convert from inches to centimeters.
↑ #to_feet ⇒ Float
The to_feet method is used to convert from inches to feet.
↑ #to_inch ⇒ Float
The to_inch method converts from inches to inches.
This does not change the value.
↑ #to_km ⇒ Float
The to_km method is used to convert from inches to kilometers.
↑ #to_m ⇒ Float
The to_m method is used to convert from inches to meters.
↑ #to_mile ⇒ Float
The to_mile method is used to convert from inches to miles.
↑ #to_mm ⇒ Float
The to_mm method is used to convert from inches to millimeters.
↑ #to_yard ⇒ Float
The to_yard method is used to convert from inches to yards.