lib/ably/modules/conversions.rb in ably-0.1.6 vs lib/ably/modules/conversions.rb in ably-0.2.0
- old
+ new
@@ -10,32 +10,32 @@
when Time
time.to_f * multiplier_from_granularity(granularity)
when Numeric
time
else
- raise ArgumentError, "time argument must be a Numeric or Time object"
+ raise ArgumentError, 'time argument must be a Numeric or Time object'
end.to_i
end
def as_time_from_epoch(time, granularity: :ms)
case time
when Numeric
Time.at(time / multiplier_from_granularity(granularity))
when Time
time
else
- raise ArgumentError, "time argument must be a Numeric or Time object"
+ raise ArgumentError, 'time argument must be a Numeric or Time object'
end
end
def multiplier_from_granularity(granularity)
case granularity
when :ms # milliseconds
1_000.0
when :s # seconds
1.0
else
- raise ArgumentError, "invalid granularity"
+ raise ArgumentError, 'invalid granularity'
end
end
# Convert key to mixedCase from mixed_case
def convert_to_mixed_case(key, force_camel: false)