summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2011-12-01 08:42:49 +0100
committerFlorian Frank <flori@ping.de>2011-12-01 08:42:49 +0100
commit0eb6ed53a2cb24d5932690c2206511a0622ab10c (patch)
tree8b082dca3a4c3c362ffb520b70978449a37dcfd9
parentb0ee15f984e3ff056f646d253b142c3e47a35e0f (diff)
downloadjson-0eb6ed53a2cb24d5932690c2206511a0622ab10c.tar.gz
Small fix: JSON.load('') # => nil
-rw-r--r--CHANGES3
-rw-r--r--VERSION2
-rw-r--r--json.gemspec4
-rw-r--r--json_pure.gemspec4
-rw-r--r--lib/json/common.rb3
-rw-r--r--lib/json/version.rb2
-rwxr-xr-xtests/test_json.rb1
7 files changed, 12 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 491a665..6bab4d7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2011-12-01 (1.6.3)
+ * Let JSON.load('') return nil as well to make mysql text columns (default to
+ '') work better for serialization.
2011-11-21 (1.6.2)
* Add support for OpenStruct and BigDecimal.
* Fix bug when parsing nil in quirks_mode.
diff --git a/VERSION b/VERSION
index fdd3be6..266146b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.6.2
+1.6.3
diff --git a/json.gemspec b/json.gemspec
index 87878e8..205757e 100644
--- a/json.gemspec
+++ b/json.gemspec
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = "json"
- s.version = "1.6.2"
+ s.version = "1.6.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Florian Frank"]
- s.date = "2011-11-28"
+ s.date = "2011-12-01"
s.description = "This is a JSON implementation as a Ruby extension in C."
s.email = "flori@ping.de"
s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
diff --git a/json_pure.gemspec b/json_pure.gemspec
index f169dbf..3bdb216 100644
--- a/json_pure.gemspec
+++ b/json_pure.gemspec
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = "json_pure"
- s.version = "1.6.2"
+ s.version = "1.6.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Florian Frank"]
- s.date = "2011-11-28"
+ s.date = "2011-12-01"
s.description = "This is a JSON implementation in pure Ruby."
s.email = "flori@ping.de"
s.extra_rdoc_files = ["README.rdoc"]
diff --git a/lib/json/common.rb b/lib/json/common.rb
index fcb1f82..cf7a8b9 100644
--- a/lib/json/common.rb
+++ b/lib/json/common.rb
@@ -313,7 +313,8 @@ module JSON
source = source.to_io.read
elsif source.respond_to?(:read)
source = source.read
- elsif source.nil? && opts[:quirks_mode]
+ end
+ if opts[:quirks_mode] && (source.nil? || source.empty?)
source = 'null'
end
result = parse(source, opts)
diff --git a/lib/json/version.rb b/lib/json/version.rb
index ee9a95a..9272c53 100644
--- a/lib/json/version.rb
+++ b/lib/json/version.rb
@@ -1,6 +1,6 @@
module JSON
# JSON version
- VERSION = '1.6.2'
+ VERSION = '1.6.3'
VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 40774b3..c308933 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -427,6 +427,7 @@ EOT
stringio.rewind
assert_equal @hash, JSON.load(stringio)
assert_equal nil, JSON.load(nil)
+ assert_equal nil, JSON.load('')
end
def test_dump