Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/ironnails/core_ext/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#minutesObject



14
15
16
# File 'lib/ironnails/core_ext/fixnum.rb', line 14

def minutes
  self * 60
end

#secondsObject



18
19
20
# File 'lib/ironnails/core_ext/fixnum.rb', line 18

def seconds
  self
end

#to_timespan(as = :seconds) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/ironnails/core_ext/fixnum.rb', line 3

def to_timespan(as=:seconds)
  case as
    when :hours || :hour
      TimeSpan.new(self, 0, 0)
    when :minutes || :minute
      TimeSpan.new(0, self, 0)
    else
      TimeSpan.new(0, 0, self)
  end
end