summaryrefslogtreecommitdiff
path: root/ext/json/lib/json/editor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/lib/json/editor.rb')
-rwxr-xr-x[-rw-r--r--]ext/json/lib/json/editor.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/json/lib/json/editor.rb b/ext/json/lib/json/editor.rb
index 12a7f94591..1e13f33c8c 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