We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 713e75d commit db08052Copy full SHA for db08052
activemodel/lib/active_model/validations/numericality.rb
@@ -86,13 +86,17 @@ def is_number?(raw_value)
86
87
def parse_raw_value_as_a_number(raw_value)
88
return raw_value.to_i if is_integer?(raw_value)
89
- Kernel.Float(raw_value) if raw_value !~ /\A0[xX]/
+ Kernel.Float(raw_value) unless is_hexadecimal_literal?(raw_value)
90
end
91
92
def is_integer?(raw_value)
93
/\A[+-]?\d+\z/ === raw_value.to_s
94
95
96
+ def is_hexadecimal_literal?(raw_value)
97
+ /\A0[xX]/ === raw_value
98
+ end
99
+
100
def filtered_options(value)
101
filtered = options.except(*RESERVED_OPTIONS)
102
filtered[:value] = value
0 commit comments