Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/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

Instance Method Details

#duration(type = nil) ⇒ 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>



512
513
514
# File 'lib/duration.rb', line 512

def duration(type = nil)
	if type == :big then BigDuration.new(to_i) else Duration.new(to_i) end
end