Module: Ago::Numbers
Instance Method Summary collapse
- #ago ⇒ Object
- #day ⇒ Object
- #days ⇒ Object
- #from_now ⇒ Object
- #hour ⇒ Object
- #hours ⇒ Object
- #minute ⇒ Object
- #minutes ⇒ Object
- #month(opts = {}) ⇒ Object
- #months(opts = {}) ⇒ Object
- #second ⇒ Object
- #seconds ⇒ Object
- #week(opts = {}) ⇒ Object
- #weeks(opts = {}) ⇒ Object
- #year(opts = {}) ⇒ Object
- #years(opts = {}) ⇒ Object
Instance Method Details
#ago ⇒ Object
5 6 7 |
# File 'lib/numbers.rb', line 5 def ago return Time.now - self end |
#day ⇒ Object
50 51 52 |
# File 'lib/numbers.rb', line 50 def day days end |
#days ⇒ Object
46 47 48 |
# File 'lib/numbers.rb', line 46 def days self * Ago::Units[:day][:basic] end |
#from_now ⇒ Object
9 10 11 |
# File 'lib/numbers.rb', line 9 def from_now return Time.now + self end |
#hour ⇒ Object
58 59 60 |
# File 'lib/numbers.rb', line 58 def hour hours end |
#hours ⇒ Object
54 55 56 |
# File 'lib/numbers.rb', line 54 def hours self * Ago::Units[:hour][:basic] end |
#minute ⇒ Object
66 67 68 |
# File 'lib/numbers.rb', line 66 def minute minutes end |
#minutes ⇒ Object
62 63 64 |
# File 'lib/numbers.rb', line 62 def minutes self * Ago::Units[:minute][:basic] end |
#month(opts = {}) ⇒ Object
31 32 33 |
# File 'lib/numbers.rb', line 31 def month(opts={}) months(opts) end |
#months(opts = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/numbers.rb', line 24 def months(opts={}) calendar = opts[:calendar] ? opts[:calendar] : :basic Ago.calendar_check(calendar) self * Ago::Units[:month][calendar] end |
#second ⇒ Object
74 75 76 |
# File 'lib/numbers.rb', line 74 def second seconds end |
#seconds ⇒ Object
70 71 72 |
# File 'lib/numbers.rb', line 70 def seconds self * Ago::Units[:second][:basic] end |
#week(opts = {}) ⇒ Object
42 43 44 |
# File 'lib/numbers.rb', line 42 def week(opts={}) weeks(opts) end |
#weeks(opts = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/numbers.rb', line 35 def weeks(opts={}) calendar = opts[:calendar] ? opts[:calendar] : :basic Ago.calendar_check(calendar) self * Ago::Units[:week][calendar] end |
#year(opts = {}) ⇒ Object
20 21 22 |
# File 'lib/numbers.rb', line 20 def year(opts={}) years(opts) end |
#years(opts = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/numbers.rb', line 13 def years(opts={}) calendar = opts[:calendar] ? opts[:calendar] : :basic Ago.calendar_check(calendar) self * Ago::Units[:year][calendar] end |