Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/greenhat/thing/helpers.rb

Overview

Instance Method Summary collapse

Instance Method Details

#floor(seconds = 60) ⇒ Object



69
70
71
# File 'lib/greenhat/thing/helpers.rb', line 69

def floor(seconds = 60)
  Time.at((to_f / seconds).floor * seconds).utc
end

#round_off(seconds = 60) ⇒ Object

Time#round already exists with different meaning in Ruby 1.9



65
66
67
# File 'lib/greenhat/thing/helpers.rb', line 65

def round_off(seconds = 60)
  Time.at((to_f / seconds).round * seconds).utc
end