Class: Fixnum
Overview
Enables FixNum conversion to time duration values (in seconds).
Instance Method Summary collapse
-
#ago ⇒ Object
5.minutes.ago = Time.now - 300.
-
#days ⇒ Object
1.days = 24.hours.
-
#format_thousands ⇒ Object
format thousands.
-
#hours ⇒ Object
1.hours = 60.minutes = 3600 (seconds).
-
#minutes ⇒ Object
1.minutes = 60 (seconds) 5.minutes = 300 (seconds).
-
#months ⇒ Object
Not exact.
-
#weeks ⇒ Object
2.weeks = 14.days.
-
#years ⇒ Object
Not exact.
Instance Method Details
#ago ⇒ Object
5.minutes.ago = Time.now - 300
354 355 356 |
# File 'lib/kiss/ext/core.rb', line 354 def ago Time.now - self end |
#days ⇒ Object
1.days = 24.hours
338 339 340 |
# File 'lib/kiss/ext/core.rb', line 338 def days self * 24.hours end |
#format_thousands ⇒ Object
format thousands
359 360 361 |
# File 'lib/kiss/ext/core.rb', line 359 def format_thousands to_s.reverse.gsub(/(\d{3})/, '\1,').sub(/\,(-?)$/, '\1').reverse end |
#hours ⇒ Object
1.hours = 60.minutes = 3600 (seconds)
343 344 345 |
# File 'lib/kiss/ext/core.rb', line 343 def hours self * 60.minutes end |
#minutes ⇒ Object
1.minutes = 60 (seconds) 5.minutes = 300 (seconds)
349 350 351 |
# File 'lib/kiss/ext/core.rb', line 349 def minutes self * 60 end |
#months ⇒ Object
Not exact
328 329 330 |
# File 'lib/kiss/ext/core.rb', line 328 def months self * 30.days end |
#weeks ⇒ Object
2.weeks = 14.days
333 334 335 |
# File 'lib/kiss/ext/core.rb', line 333 def weeks self * 7.days end |
#years ⇒ Object
Not exact
323 324 325 |
# File 'lib/kiss/ext/core.rb', line 323 def years self * 365.days end |