@@ -42,20 +42,20 @@ def current
42
42
43
43
# Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
44
44
# instances can be used when called with a single argument
45
- def at_with_coercion ( *args , **kwargs )
46
- return at_without_coercion ( *args , **kwargs ) if args . size != 1 || !kwargs . empty?
47
-
48
- # Time.at can be called with a time or numerical value
49
- time_or_number = args . first
50
-
51
- if time_or_number . is_a? ( ActiveSupport ::TimeWithZone )
52
- at_without_coercion ( time_or_number . to_r ) . getlocal
53
- elsif time_or_number . is_a? ( DateTime )
54
- at_without_coercion ( time_or_number . to_f ) . getlocal
45
+ def at_with_coercion ( time_or_number , *args )
46
+ if args . empty?
47
+ if time_or_number . is_a? ( ActiveSupport ::TimeWithZone )
48
+ at_without_coercion ( time_or_number . to_r ) . getlocal
49
+ elsif time_or_number . is_a? ( DateTime )
50
+ at_without_coercion ( time_or_number . to_f ) . getlocal
51
+ else
52
+ at_without_coercion ( time_or_number )
53
+ end
55
54
else
56
- at_without_coercion ( time_or_number )
55
+ at_without_coercion ( time_or_number , * args )
57
56
end
58
57
end
58
+ ruby2_keywords :at_with_coercion
59
59
alias_method :at_without_coercion , :at
60
60
alias_method :at , :at_with_coercion
61
61
0 commit comments