summaryrefslogtreecommitdiff
path: root/ext/json/lib/json/editor.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-05 02:32:49 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-05 02:32:49 +0000
commit4f364c6bf7f5bcc064b5a12b235fd63b200359a0 (patch)
tree057f7862f43f36e096a5037c9fcdcd1259a4c5d4 /ext/json/lib/json/editor.rb
parent1735892962c9e05ff679fc32f933a66141b2cbaf (diff)
Update to JSON 1.1.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 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