module Rounding::TimeExtensions
Public Instance Methods
ceil_in_utc_to(step)
click to toggle source
# File lib/rounding/time_extensions.rb, line 30 def ceil_in_utc_to(step) ceil_to(step, 0) end
ceil_to(step, around=-utc_offset)
click to toggle source
# File lib/rounding/time_extensions.rb, line 10 def ceil_to(step, around=-utc_offset) step = step.to_r around = around.to_r rational_self = self.to_r difference = rational_self - rational_self.ceil_to(step, around) self - difference end
floor_in_utc_to(step)
click to toggle source
# File lib/rounding/time_extensions.rb, line 26 def floor_in_utc_to(step) floor_to(step, 0) end
floor_to(step, around=-utc_offset)
click to toggle source
# File lib/rounding/time_extensions.rb, line 2 def floor_to(step, around=-utc_offset) step = step.to_r around = around.to_r rational_self = self.to_r difference = rational_self - rational_self.floor_to(step, around) self - difference end
round_in_utc_to(step)
click to toggle source
# File lib/rounding/time_extensions.rb, line 34 def round_in_utc_to(step) round_to(step, 0) end
round_to(step, around=-utc_offset)
click to toggle source
# File lib/rounding/time_extensions.rb, line 18 def round_to(step, around=-utc_offset) step = step.to_r around = around.to_r rational_self = self.to_r difference = rational_self - rational_self.round_to(step, around) self - difference end