Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
clock / lib / clock / utc.rb
Size: Mime:
module Clock
  class UTC
    include Clock

    def self.canonize(time, *)
      Clock.utc(time)
    end

    def coerce(time)
      self.class.shift(time)
    end

    def self.coerce(time)
      if time.is_a? String
        time = Time.parse(time)
      end

      offset = time.gmt_offset

      utc_time = time.getutc

      utc_time = utc_time + offset

      now(utc_time)
    end

    module Substitute
      def self.build
        Clock::Substitute.new
      end
    end
  end
end