Class | Duration |
In: |
lib/more/facets/duration.rb
|
Parent: | Object |
SECOND | = | 1 |
MINUTE | = | 60 * SECOND |
HOUR | = | 60 * MINUTE |
DAY | = | 24 * HOUR |
WEEK | = | 7 * DAY |
YEAR | = | 365 * DAY |
SEGMENTS | = | %w{years weeks days hours minutes seconds}.collect{ |s| s.to_sym } |
Returns true if other is also a Duration instance with the same value, or if other == value.
Format duration.
Identifiers
%w -- Number of weeks %d -- Number of days %h -- Number of hours %m -- Number of minutes %s -- Number of seconds %t -- Total number of seconds %x -- Duration#to_s %% -- Literal `%' character
Example
d = Duration.new(:weeks => 10, :days => 7) => #<Duration: 11 weeks> d.strftime("It's been %w weeks!") => "It's been 11 weeks!"