Module: RichUnits::Duration::Time
- Included in:
- Time
- Defined in:
- lib/richunits/duration.rb
Overview
Time#duration has been added to convert the UNIX timestamp into a Duration. See Time#duration for an example.
Instance Method Summary collapse
-
#duration ⇒ Object
Create a Duration object from the UNIX timestamp.
Instance Method Details
#duration ⇒ Object
Create a Duration object from the UNIX timestamp.
Example
Time.now.duration
=> #<Duration: 1898 weeks, 6 days, 1 hour, 12 minutes and 1 second>
289 290 291 |
# File 'lib/richunits/duration.rb', line 289 def duration Duration[to_i] end |