class Time
Public Instance Methods
ceil(height = 1)
click to toggle source
Find ceil time @param [Fixnum] height The minutes of height for ceil. Defaults to 1
# File lib/octocore-mongo/utils.rb, line 39 def ceil(height = 1) if height < 1 height = 1 end sec = height.to_i * 60 Time.at((1 + (self.to_i / sec)).round * sec) end
floor(height = 1)
click to toggle source
Find floor time @param [Fixnum] height The minutes of height for floor. Defaults to 1
# File lib/octocore-mongo/utils.rb, line 29 def floor(height = 1) if height < 1 height = 1 end sec = height.to_i * 60 Time.at((self.to_i / sec).round * sec) end
to(to, step = 15.minutes)
click to toggle source
Finds the steps between two time. @param [Time] to The end time @param [Time] step The step time. Defaults to 15.minute @return [Array<Time>] An array containint times
# File lib/octocore-mongo/utils.rb, line 51 def to(to, step = 15.minutes) [self].tap { |array| array << array.last + step while array.last < to } end