diff options
author | Florian Frank <flori@ping.de> | 2011-01-02 23:37:10 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2011-01-02 23:42:29 +0100 |
commit | 6dc725aee27ddf514593ffafc9a98e3b20e698d3 (patch) | |
tree | 1bce6e88780fec52afadb60135e4a12f7f8b5456 | |
parent | cfa34b24853078f5b91bbed97d8da84fffac0077 (diff) | |
download | json-6dc725aee27ddf514593ffafc9a98e3b20e698d3.tar.gz |
Rubinius' strscan already has a @match ivar
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | lib/json/pure/parser.rb | 6 | ||||
-rw-r--r-- | tests/test_json_string_matching.rb | 2 |
4 files changed, 7 insertions, 5 deletions
@@ -2,3 +2,5 @@ coverage pkg .nfs.* +.idea +java/Json.iml @@ -23,7 +23,7 @@ MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') } PKG_NAME = 'json' PKG_TITLE = 'JSON Implementation for Ruby' PKG_VERSION = File.read('VERSION').chomp -PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/) +PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\.|\.iml\Z/).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/) EXT_ROOT_DIR = 'ext/json/ext' EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser" diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb index cb531f4..6a0192c 100644 --- a/lib/json/pure/parser.rb +++ b/lib/json/pure/parser.rb @@ -119,7 +119,7 @@ module JSON @create_id = opts[:create_id] || JSON.create_id @object_class = opts[:object_class] || Hash @array_class = opts[:array_class] || Array - @match = opts[:match] + @json_match = opts[:match] # @match is an ivar in rbx's strscan end alias source string @@ -189,8 +189,8 @@ module JSON if string.respond_to?(:force_encoding) string.force_encoding(::Encoding::UTF_8) end - if @create_additions and @match - for (regexp, klass) in @match + if @create_additions and @json_match + for (regexp, klass) in @json_match klass.json_creatable? or next string =~ regexp and return klass.json_create(string) end diff --git a/tests/test_json_string_matching.rb b/tests/test_json_string_matching.rb index 149a63b..6bd74e3 100644 --- a/tests/test_json_string_matching.rb +++ b/tests/test_json_string_matching.rb @@ -9,7 +9,7 @@ require 'time' class TestJsonStringMatching < Test::Unit::TestCase include JSON - class TestTime < Time + class TestTime < ::Time def self.json_create(string) Time.parse(string) end |