Sha256: 2f7bf038d7da0a506f3576ac029e7c8b3471c3e2dafffbcd90879c31e7d9c237

Contents?: true

Size: 588 Bytes

Versions: 8

Compression:

Stored size: 588 Bytes

Contents

module Polyfill
  module V2_5
    module Time
      module ClassMethods
        def at(*args)
          if args.size < 3 || args[2] == :microsecond || args[2] == :usec
            return super(*args.first(2))
          end

          seconds, partial_seconds, unit = args

          case unit
          when :millisecond
            super(seconds, partial_seconds * 1000)
          when :nanosecond, :nsec
            super(seconds, partial_seconds / 1000.0)
          else
            raise ArgumentError, "unexpected unit: #{unit}"
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
polyfill-1.9.0 lib/polyfill/v2_5/time.rb
polyfill-1.8.0 lib/polyfill/v2_5/time.rb
polyfill-1.7.0 lib/polyfill/v2_5/time.rb
polyfill-1.6.0 lib/polyfill/v2_5/time.rb
polyfill-1.5.0 lib/polyfill/v2_5/time.rb
polyfill-1.4.0 lib/polyfill/v2_5/time.rb
polyfill-1.3.0 lib/polyfill/v2_5/time.rb
polyfill-1.2.0 lib/polyfill/v2_5/time.rb