Sha256: 5a05c7704e03af9cf3e592b9d21b6297c9577b1cf07d639a41f481bc19fc083f
Contents?: true
Size: 549 Bytes
Versions: 12
Compression:
Stored size: 549 Bytes
Contents
require 'time' module BerkeleyLibrary module Util module Times class << self include Times end # @param time [Time, Date] the time # @return the UTC time corresponding to `time` def ensure_utc(time) return unless time return time if time.respond_to?(:utc?) && time.utc? return time.getutc if time.respond_to?(:getutc) return time.to_time.getutc if time.respond_to?(:to_time) raise ArgumentError, "Not a date or time: #{time.inspect}" end end end end
Version data entries
12 entries across 12 versions & 2 rubygems