diff options
Diffstat (limited to 'ext/json/lib/json/editor.rb')
-rwxr-xr-x[-rw-r--r--] | ext/json/lib/json/editor.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/json/lib/json/editor.rb b/ext/json/lib/json/editor.rb index ad86fdb15e..9e05f44b5b 100644..100755 --- a/ext/json/lib/json/editor.rb +++ b/ext/json/lib/json/editor.rb @@ -769,7 +769,12 @@ module JSON iter.type, iter.content = 'FalseClass', 'false' end when 'Numeric' - iter.content = (Integer(value) rescue Float(value) rescue 0).to_s + iter.content = + if value == 'Infinity' + value + else + (Integer(value) rescue Float(value) rescue 0).to_s + end when 'String' iter.content = value when 'Hash', 'Array' @@ -937,7 +942,11 @@ module JSON type = types[type_input.active] @content = case type when 'Numeric' - Integer(value_input.text) rescue Float(value_input.text) rescue 0 + if (t = value_input.text) == 'Infinity' + 1 / 0.0 + else + Integer(t) rescue Float(t) rescue 0 + end else value_input.text end.to_s |