Class: Numeric
- Defined in:
- lib/all/sugarcube-numbers/time.rb,
lib/all/sugarcube-numbers/numeric.rb
Instance Method Summary collapse
- #bytes ⇒ Object (also: #byte)
- #days ⇒ Object (also: #day)
- #degrees ⇒ Object (also: #degree)
- #exabytes ⇒ Object (also: #exabyte)
- #feet ⇒ Object (also: #foot)
- #g ⇒ Object
- #gigabytes ⇒ Object (also: #gigabyte)
- #hours ⇒ Object (also: #hour)
- #in_bytes ⇒ Object
- #in_days ⇒ Object (also: #per_day)
- #in_degrees ⇒ Object
- #in_exabytes ⇒ Object
- #in_feet ⇒ Object
- #in_g ⇒ Object
- #in_gigabytes ⇒ Object
- #in_hours ⇒ Object (also: #per_hour)
- #in_kilobytes ⇒ Object
- #in_kilometers ⇒ Object
- #in_megabytes ⇒ Object
- #in_meters ⇒ Object
- #in_miles ⇒ Object
- #in_milliseconds ⇒ Object (also: #per_millisecond)
- #in_minutes ⇒ Object (also: #per_minute)
- #in_months ⇒ Object (also: #per_month)
- #in_petabytes ⇒ Object
- #in_radians ⇒ Object
- #in_seconds ⇒ Object (also: #per_second)
- #in_terabytes ⇒ Object
- #in_weeks ⇒ Object (also: #per_week)
- #in_years ⇒ Object (also: #per_year)
- #kilobytes ⇒ Object (also: #kilobyte)
- #kilometers ⇒ Object (also: #kilometer)
- #megabytes ⇒ Object (also: #megabyte)
- #meters ⇒ Object (also: #meter)
- #miles ⇒ Object (also: #mile)
- #milliseconds ⇒ Object (also: #millisecond, #millisecs, #millisec)
- #minutes ⇒ Object (also: #minute, #min, #mins)
-
#months ⇒ Object
(also: #month)
INACCURATE and COULD CHANGE in the future.
- #percent ⇒ Object
- #petabytes ⇒ Object (also: #petabyte)
- #pi ⇒ Object
- #radians ⇒ Object (also: #radian)
- #seconds ⇒ Object (also: #second, #sec, #secs)
- #terabytes ⇒ Object (also: #terabyte)
- #weeks ⇒ Object (also: #week)
-
#years ⇒ Object
(also: #year)
INACCURATE and COULD CHANGE in the future.
Instance Method Details
#bytes ⇒ Object Also known as: byte
73 74 75 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 73 def bytes self end |
#days ⇒ Object Also known as: day
49 50 51 |
# File 'lib/all/sugarcube-numbers/time.rb', line 49 def days self.hours * 24 end |
#degrees ⇒ Object Also known as: degree
24 25 26 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 24 def degrees self / 180.0 * Math::PI end |
#exabytes ⇒ Object Also known as: exabyte
103 104 105 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 103 def exabytes self * 1024**6 end |
#feet ⇒ Object Also known as: foot
64 65 66 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 64 def feet self / 3.28084 # 3.28084 m / ft end |
#g ⇒ Object
7 8 9 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 7 def g self * 9.78033 end |
#gigabytes ⇒ Object Also known as: gigabyte
88 89 90 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 88 def gigabytes self * 1024**3 end |
#hours ⇒ Object Also known as: hour
39 40 41 |
# File 'lib/all/sugarcube-numbers/time.rb', line 39 def hours self * 3600 end |
#in_bytes ⇒ Object
108 109 110 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 108 def in_bytes self end |
#in_days ⇒ Object Also known as: per_day
54 55 56 |
# File 'lib/all/sugarcube-numbers/time.rb', line 54 def in_days self / 1.day.to_f end |
#in_degrees ⇒ Object
29 30 31 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 29 def in_degrees self * 180.0 / Math::PI end |
#in_exabytes ⇒ Object
132 133 134 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 132 def in_exabytes self / 1024**6 end |
#in_feet ⇒ Object
69 70 71 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 69 def in_feet self / 1.foot end |
#in_g ⇒ Object
11 12 13 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 11 def in_g self / 9.78033 end |
#in_gigabytes ⇒ Object
120 121 122 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 120 def in_gigabytes self / 1024**3 end |
#in_hours ⇒ Object Also known as: per_hour
44 45 46 |
# File 'lib/all/sugarcube-numbers/time.rb', line 44 def in_hours self / 1.hour.to_f end |
#in_kilobytes ⇒ Object
112 113 114 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 112 def in_kilobytes self / 1024**1 end |
#in_kilometers ⇒ Object
51 52 53 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 51 def in_kilometers self / 1.kilometer end |
#in_megabytes ⇒ Object
116 117 118 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 116 def in_megabytes self / 1024**2 end |
#in_meters ⇒ Object
42 43 44 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 42 def in_meters self end |
#in_miles ⇒ Object
60 61 62 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 60 def in_miles self / 1.mile end |
#in_milliseconds ⇒ Object Also known as: per_millisecond
10 11 12 |
# File 'lib/all/sugarcube-numbers/time.rb', line 10 def in_milliseconds self * 1000 end |
#in_minutes ⇒ Object Also known as: per_minute
34 35 36 |
# File 'lib/all/sugarcube-numbers/time.rb', line 34 def in_minutes self / 1.minute.to_f end |
#in_months ⇒ Object Also known as: per_month
75 76 77 |
# File 'lib/all/sugarcube-numbers/time.rb', line 75 def in_months self / 1.month.to_f end |
#in_petabytes ⇒ Object
128 129 130 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 128 def in_petabytes self / 1024**5 end |
#in_radians ⇒ Object
20 21 22 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 20 def in_radians self end |
#in_seconds ⇒ Object Also known as: per_second
22 23 24 |
# File 'lib/all/sugarcube-numbers/time.rb', line 22 def in_seconds self end |
#in_terabytes ⇒ Object
124 125 126 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 124 def in_terabytes self / 1024**4 end |
#in_weeks ⇒ Object Also known as: per_week
64 65 66 |
# File 'lib/all/sugarcube-numbers/time.rb', line 64 def in_weeks self / 1.week.to_f end |
#in_years ⇒ Object Also known as: per_year
86 87 88 |
# File 'lib/all/sugarcube-numbers/time.rb', line 86 def in_years self / 1.year.to_f end |
#kilobytes ⇒ Object Also known as: kilobyte
78 79 80 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 78 def kilobytes self * 1024**1 end |
#kilometers ⇒ Object Also known as: kilometer
46 47 48 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 46 def kilometers self * 1000.0 # 1000 m / km end |
#megabytes ⇒ Object Also known as: megabyte
83 84 85 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 83 def megabytes self * 1024**2 end |
#meters ⇒ Object Also known as: meter
37 38 39 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 37 def meters self end |
#miles ⇒ Object Also known as: mile
55 56 57 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 55 def miles self * 1609.344 # 1609.344 m / mi end |
#milliseconds ⇒ Object Also known as: millisecond, millisecs, millisec
3 4 5 |
# File 'lib/all/sugarcube-numbers/time.rb', line 3 def milliseconds self / 1000.0 end |
#minutes ⇒ Object Also known as: minute, min, mins
27 28 29 |
# File 'lib/all/sugarcube-numbers/time.rb', line 27 def minutes self * 60 end |
#months ⇒ Object Also known as: month
INACCURATE and COULD CHANGE in the future.
70 71 72 |
# File 'lib/all/sugarcube-numbers/time.rb', line 70 def months self.days * 30.416 end |
#percent ⇒ Object
3 4 5 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 3 def percent self / 100.0 end |
#petabytes ⇒ Object Also known as: petabyte
98 99 100 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 98 def petabytes self * 1024**5 end |
#pi ⇒ Object
33 34 35 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 33 def pi self * Math::PI end |
#radians ⇒ Object Also known as: radian
15 16 17 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 15 def radians self end |
#seconds ⇒ Object Also known as: second, sec, secs
15 16 17 |
# File 'lib/all/sugarcube-numbers/time.rb', line 15 def seconds self end |
#terabytes ⇒ Object Also known as: terabyte
93 94 95 |
# File 'lib/all/sugarcube-numbers/numeric.rb', line 93 def terabytes self * 1024**4 end |
#weeks ⇒ Object Also known as: week
59 60 61 |
# File 'lib/all/sugarcube-numbers/time.rb', line 59 def weeks self.days * 7 end |
#years ⇒ Object Also known as: year
INACCURATE and COULD CHANGE in the future.
81 82 83 |
# File 'lib/all/sugarcube-numbers/time.rb', line 81 def years self.days * 365.25 end |