Class: Numeric

Inherits:
Object show all
Defined in:
lib/all/sugarcube-numbers/time.rb,
lib/all/sugarcube-numbers/numeric.rb

Instance Method Summary collapse

Instance Method Details

#bytesObject Also known as: byte



73
74
75
# File 'lib/all/sugarcube-numbers/numeric.rb', line 73

def bytes
  self
end

#daysObject Also known as: day



49
50
51
# File 'lib/all/sugarcube-numbers/time.rb', line 49

def days
  self.hours * 24
end

#degreesObject Also known as: degree



24
25
26
# File 'lib/all/sugarcube-numbers/numeric.rb', line 24

def degrees
  self / 180.0 * Math::PI
end

#exabytesObject Also known as: exabyte



103
104
105
# File 'lib/all/sugarcube-numbers/numeric.rb', line 103

def exabytes
  self * 1024**6
end

#feetObject 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

#gObject



7
8
9
# File 'lib/all/sugarcube-numbers/numeric.rb', line 7

def g
  self * 9.78033
end

#gigabytesObject Also known as: gigabyte



88
89
90
# File 'lib/all/sugarcube-numbers/numeric.rb', line 88

def gigabytes
  self * 1024**3
end

#hoursObject Also known as: hour



39
40
41
# File 'lib/all/sugarcube-numbers/time.rb', line 39

def hours
  self * 3600
end

#in_bytesObject



108
109
110
# File 'lib/all/sugarcube-numbers/numeric.rb', line 108

def in_bytes
  self
end

#in_daysObject 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_degreesObject



29
30
31
# File 'lib/all/sugarcube-numbers/numeric.rb', line 29

def in_degrees
  self * 180.0 / Math::PI
end

#in_exabytesObject



132
133
134
# File 'lib/all/sugarcube-numbers/numeric.rb', line 132

def in_exabytes
  self / 1024**6
end

#in_feetObject



69
70
71
# File 'lib/all/sugarcube-numbers/numeric.rb', line 69

def in_feet
  self / 1.foot
end

#in_gObject



11
12
13
# File 'lib/all/sugarcube-numbers/numeric.rb', line 11

def in_g
  self / 9.78033
end

#in_gigabytesObject



120
121
122
# File 'lib/all/sugarcube-numbers/numeric.rb', line 120

def in_gigabytes
  self / 1024**3
end

#in_hoursObject 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_kilobytesObject



112
113
114
# File 'lib/all/sugarcube-numbers/numeric.rb', line 112

def in_kilobytes
  self / 1024**1
end

#in_kilometersObject



51
52
53
# File 'lib/all/sugarcube-numbers/numeric.rb', line 51

def in_kilometers
  self / 1.kilometer
end

#in_megabytesObject



116
117
118
# File 'lib/all/sugarcube-numbers/numeric.rb', line 116

def in_megabytes
  self / 1024**2
end

#in_metersObject



42
43
44
# File 'lib/all/sugarcube-numbers/numeric.rb', line 42

def in_meters
  self
end

#in_milesObject



60
61
62
# File 'lib/all/sugarcube-numbers/numeric.rb', line 60

def in_miles
  self / 1.mile
end

#in_millisecondsObject Also known as: per_millisecond



10
11
12
# File 'lib/all/sugarcube-numbers/time.rb', line 10

def in_milliseconds
  self * 1000
end

#in_minutesObject 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_monthsObject 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_petabytesObject



128
129
130
# File 'lib/all/sugarcube-numbers/numeric.rb', line 128

def in_petabytes
  self / 1024**5
end

#in_radiansObject



20
21
22
# File 'lib/all/sugarcube-numbers/numeric.rb', line 20

def in_radians
  self
end

#in_secondsObject Also known as: per_second



22
23
24
# File 'lib/all/sugarcube-numbers/time.rb', line 22

def in_seconds
  self
end

#in_terabytesObject



124
125
126
# File 'lib/all/sugarcube-numbers/numeric.rb', line 124

def in_terabytes
  self / 1024**4
end

#in_weeksObject 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_yearsObject 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

#kilobytesObject Also known as: kilobyte



78
79
80
# File 'lib/all/sugarcube-numbers/numeric.rb', line 78

def kilobytes
  self * 1024**1
end

#kilometersObject 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

#megabytesObject Also known as: megabyte



83
84
85
# File 'lib/all/sugarcube-numbers/numeric.rb', line 83

def megabytes
  self * 1024**2
end

#metersObject Also known as: meter



37
38
39
# File 'lib/all/sugarcube-numbers/numeric.rb', line 37

def meters
  self
end

#milesObject 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

#millisecondsObject Also known as: millisecond, millisecs, millisec



3
4
5
# File 'lib/all/sugarcube-numbers/time.rb', line 3

def milliseconds
  self / 1000.0
end

#minutesObject Also known as: minute, min, mins



27
28
29
# File 'lib/all/sugarcube-numbers/time.rb', line 27

def minutes
  self * 60
end

#monthsObject 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

#percentObject



3
4
5
# File 'lib/all/sugarcube-numbers/numeric.rb', line 3

def percent
  self / 100.0
end

#petabytesObject Also known as: petabyte



98
99
100
# File 'lib/all/sugarcube-numbers/numeric.rb', line 98

def petabytes
  self * 1024**5
end

#piObject



33
34
35
# File 'lib/all/sugarcube-numbers/numeric.rb', line 33

def pi
  self * Math::PI
end

#radiansObject Also known as: radian



15
16
17
# File 'lib/all/sugarcube-numbers/numeric.rb', line 15

def radians
  self
end

#secondsObject Also known as: second, sec, secs



15
16
17
# File 'lib/all/sugarcube-numbers/time.rb', line 15

def seconds
  self
end

#terabytesObject Also known as: terabyte



93
94
95
# File 'lib/all/sugarcube-numbers/numeric.rb', line 93

def terabytes
  self * 1024**4
end

#weeksObject Also known as: week



59
60
61
# File 'lib/all/sugarcube-numbers/time.rb', line 59

def weeks
  self.days * 7
end

#yearsObject 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