class DateTime
Constants
- UNIX_EPOCH
Public Instance Methods
ceil_in_utc_to(step)
click to toggle source
# File lib/rounding/core_ext/date_time.rb, line 40 def ceil_in_utc_to(step) ceil_to(step, UNIX_EPOCH) end
ceil_to(step, around=-offset)
click to toggle source
Calls superclass method
Rounding::TimeExtensions#ceil_to
# File lib/rounding/core_ext/date_time.rb, line 24 def ceil_to(step, around=-offset) step = decode_duration(step) around = decode_duration(around) super(step, around) end
floor_in_utc_to(step)
click to toggle source
# File lib/rounding/core_ext/date_time.rb, line 36 def floor_in_utc_to(step) floor_to(step, UNIX_EPOCH) end
floor_to(step, around=-offset)
click to toggle source
Calls superclass method
Rounding::TimeExtensions#floor_to
# File lib/rounding/core_ext/date_time.rb, line 18 def floor_to(step, around=-offset) step = decode_duration(step) around = decode_duration(around) super(step, around) end
round_in_utc_to(step)
click to toggle source
# File lib/rounding/core_ext/date_time.rb, line 44 def round_in_utc_to(step) round_to(step, UNIX_EPOCH) end
round_to(step, around=-offset)
click to toggle source
Calls superclass method
Rounding::TimeExtensions#round_to
# File lib/rounding/core_ext/date_time.rb, line 30 def round_to(step, around=-offset) step = decode_duration(step) around = decode_duration(around) super(step, around) end
to_r()
click to toggle source
# File lib/rounding/core_ext/date_time.rb, line 13 def to_r no_offset = new_offset(0) no_offset.jd + no_offset.day_fraction end
Private Instance Methods
decode_duration(value)
click to toggle source
# File lib/rounding/core_ext/date_time.rb, line 50 def decode_duration(value) if defined?(ActiveSupport::Duration) && ActiveSupport::Duration === value value.to_r / 1.day.to_r else value end end