Module: Polyfill::V2_5::Time::ClassMethods
- Defined in:
- lib/polyfill/v2_5/time.rb
Instance Method Summary collapse
Instance Method Details
#at(*args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/polyfill/v2_5/time.rb', line 5 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 |