json 1.6.5 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- data/.gitignore +3 -0
- data/.travis.yml +4 -3
- data/CHANGES +7 -0
- data/Gemfile +2 -2
- data/README.rdoc +1 -1
- data/Rakefile +48 -58
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +17 -8
- data/ext/json/ext/generator/generator.h +1 -0
- data/install.rb +7 -3
- data/java/src/json/ext/StringDecoder.java +1 -0
- data/json.gemspec +6 -9
- data/json_pure.gemspec +5 -8
- data/lib/json/pure/generator.rb +6 -2
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +3 -3
- data/tests/test_json_generate.rb +18 -16
- metadata +26 -63
- data/benchmarks/data-p4-3GHz-ruby18/.keep +0 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
- data/benchmarks/data/.keep +0 -0
- data/benchmarks/generator2_benchmark.rb +0 -222
- data/benchmarks/generator_benchmark.rb +0 -224
- data/benchmarks/ohai.json +0 -1216
- data/benchmarks/ohai.ruby +0 -1
- data/benchmarks/parser2_benchmark.rb +0 -251
- data/benchmarks/parser_benchmark.rb +0 -259
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2012-02-11 (1.6.6)
|
2
|
+
* Propagate src encoding to values made from it (fixes 1.9 mode converting
|
3
|
+
everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo
|
4
|
+
<tom.enebo@gmail.com>), should fix
|
5
|
+
https://github.com/flori/json/issues#issue/119.
|
6
|
+
* Fix https://github.com/flori/json/issues#issue/124 Thx to Jason Hutchens.
|
7
|
+
* Fix https://github.com/flori/json/issues#issue/117
|
1
8
|
2012-01-15 (1.6.5)
|
2
9
|
* Vit Ondruch <v.ondruch@tiscali.cz> reported a bug that shows up when using
|
3
10
|
optimisation under GCC 4.7. Thx to him, Bohuslav Kabrda
|
data/Gemfile
CHANGED
@@ -6,10 +6,10 @@ gemspec :name => 'json'
|
|
6
6
|
gemspec :name => 'json_pure'
|
7
7
|
gemspec :name => 'json-java'
|
8
8
|
|
9
|
-
group :development do
|
9
|
+
group :development, :test do
|
10
10
|
gem 'simplecov', :platform => :mri_19
|
11
11
|
end
|
12
12
|
|
13
13
|
group :test do
|
14
|
-
gem 'test-unit', :platform => :mri_19
|
14
|
+
gem 'test-unit', '2.4.7', :platform => :mri_19
|
15
15
|
end
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -4,21 +4,27 @@ rescue LoadError
|
|
4
4
|
end
|
5
5
|
|
6
6
|
require 'rbconfig'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
include\
|
8
|
+
begin
|
9
|
+
RbConfig
|
10
|
+
rescue NameError
|
11
|
+
Config
|
12
|
+
end
|
13
13
|
|
14
14
|
require 'rake/clean'
|
15
|
-
CLOBBER.include
|
15
|
+
CLOBBER.include 'doc', 'Gemfile.lock'
|
16
16
|
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
|
17
17
|
FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'],
|
18
18
|
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class,dSYM}"],
|
19
19
|
FileList['java/src/**/*.class']
|
20
20
|
|
21
|
-
|
21
|
+
require 'rake/testtask'
|
22
|
+
class UndocumentedTestTask < Rake::TestTask
|
23
|
+
def desc(*) end
|
24
|
+
end
|
25
|
+
|
26
|
+
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
|
27
|
+
BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
|
22
28
|
PKG_NAME = 'json'
|
23
29
|
PKG_TITLE = 'JSON Implementation for Ruby'
|
24
30
|
PKG_VERSION = File.read('VERSION').chomp
|
@@ -44,19 +50,9 @@ JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
|
|
44
50
|
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
45
51
|
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
46
52
|
|
47
|
-
def myruby(*args, &block)
|
48
|
-
@myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
|
49
|
-
options = (Hash === args.last) ? args.pop : {}
|
50
|
-
if args.length > 1 then
|
51
|
-
sh(*([@myruby] + args + [options]), &block)
|
52
|
-
else
|
53
|
-
sh("#{@myruby} #{args.first}", options, &block)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
53
|
desc "Installing library (pure)"
|
58
54
|
task :install_pure => :version do
|
59
|
-
|
55
|
+
ruby 'install.rb'
|
60
56
|
end
|
61
57
|
|
62
58
|
task :install_ext_really do
|
@@ -75,11 +71,7 @@ desc "Installing library (extension)"
|
|
75
71
|
task :install_ext => [ :compile, :install_pure, :install_ext_really ]
|
76
72
|
|
77
73
|
desc "Installing library (extension)"
|
78
|
-
|
79
|
-
task :install => :install_pure
|
80
|
-
else
|
81
|
-
task :install => :install_ext
|
82
|
-
end
|
74
|
+
task :install => :install_ext
|
83
75
|
|
84
76
|
if defined?(Gem) and defined?(Gem::PackageTask)
|
85
77
|
spec_pure = Gem::Specification.new do |s|
|
@@ -92,7 +84,6 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
92
84
|
|
93
85
|
s.require_path = 'lib'
|
94
86
|
s.add_development_dependency 'permutation'
|
95
|
-
s.add_development_dependency 'bullshit'
|
96
87
|
s.add_development_dependency 'sdoc'
|
97
88
|
s.add_development_dependency 'rake', '~>0.9.2'
|
98
89
|
|
@@ -133,7 +124,6 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
133
124
|
s.require_paths << 'ext'
|
134
125
|
s.require_paths << 'lib'
|
135
126
|
s.add_development_dependency 'permutation'
|
136
|
-
s.add_development_dependency 'bullshit'
|
137
127
|
s.add_development_dependency 'sdoc'
|
138
128
|
|
139
129
|
s.extra_rdoc_files << 'README.rdoc'
|
@@ -182,18 +172,26 @@ EOT
|
|
182
172
|
end
|
183
173
|
|
184
174
|
desc "Testing library (pure ruby)"
|
185
|
-
task :test_pure => :clean
|
186
|
-
|
187
|
-
|
188
|
-
|
175
|
+
task :test_pure => [ :clean, :do_test_pure ]
|
176
|
+
|
177
|
+
UndocumentedTestTask.new do |t|
|
178
|
+
t.name = 'do_test_pure'
|
179
|
+
t.libs << 'lib'
|
180
|
+
t.test_files = FileList['tests/test_*.rb']
|
181
|
+
t.verbose = true
|
182
|
+
t.options = '-v'
|
189
183
|
end
|
190
184
|
|
191
185
|
desc "Testing library (pure ruby and extension)"
|
192
|
-
task :test
|
186
|
+
task :test do
|
187
|
+
sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
|
188
|
+
sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
|
189
|
+
end
|
193
190
|
|
194
191
|
namespace :gems do
|
192
|
+
desc 'Install all development gems'
|
195
193
|
task :install do
|
196
|
-
sh
|
194
|
+
sh "#{BUNDLE}"
|
197
195
|
end
|
198
196
|
end
|
199
197
|
|
@@ -250,9 +248,14 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
|
250
248
|
end
|
251
249
|
|
252
250
|
desc "Testing library (jruby)"
|
253
|
-
task :test_ext => :create_jar
|
254
|
-
|
255
|
-
|
251
|
+
task :test_ext => [ :create_jar, :do_test_ext ]
|
252
|
+
|
253
|
+
UndocumentedTestTask.new do |t|
|
254
|
+
t.name = 'do_test_ext'
|
255
|
+
t.libs << 'lib'
|
256
|
+
t.test_files = FileList['tests/test_*.rb']
|
257
|
+
t.verbose = true
|
258
|
+
t.options = '-v'
|
256
259
|
end
|
257
260
|
|
258
261
|
file JRUBY_PARSER_JAR => :compile do
|
@@ -304,7 +307,7 @@ else
|
|
304
307
|
|
305
308
|
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
306
309
|
cd EXT_PARSER_DIR do
|
307
|
-
|
310
|
+
ruby 'extconf.rb'
|
308
311
|
sh MAKE
|
309
312
|
end
|
310
313
|
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
@@ -312,36 +315,23 @@ else
|
|
312
315
|
|
313
316
|
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
314
317
|
cd EXT_GENERATOR_DIR do
|
315
|
-
|
318
|
+
ruby 'extconf.rb'
|
316
319
|
sh MAKE
|
317
320
|
end
|
318
321
|
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
319
322
|
end
|
320
323
|
|
321
324
|
desc "Testing library (extension)"
|
322
|
-
task :test_ext => :compile
|
323
|
-
|
324
|
-
|
325
|
-
|
325
|
+
task :test_ext => [ :compile, :do_test_ext ]
|
326
|
+
|
327
|
+
UndocumentedTestTask.new do |t|
|
328
|
+
t.name = 'do_test_ext'
|
329
|
+
t.libs << 'ext' << 'lib'
|
330
|
+
t.test_files = FileList['tests/test_*.rb']
|
331
|
+
t.verbose = true
|
332
|
+
t.options = '-v'
|
326
333
|
end
|
327
334
|
|
328
|
-
desc "Benchmarking parser"
|
329
|
-
task :benchmark_parser do
|
330
|
-
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
331
|
-
myruby 'benchmarks/parser_benchmark.rb'
|
332
|
-
myruby 'benchmarks/parser2_benchmark.rb'
|
333
|
-
end
|
334
|
-
|
335
|
-
desc "Benchmarking generator"
|
336
|
-
task :benchmark_generator do
|
337
|
-
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
338
|
-
myruby 'benchmarks/generator_benchmark.rb'
|
339
|
-
myruby 'benchmarks/generator2_benchmark.rb'
|
340
|
-
end
|
341
|
-
|
342
|
-
desc "Benchmarking library"
|
343
|
-
task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
344
|
-
|
345
335
|
desc "Create RDOC documentation"
|
346
336
|
task :doc => [ :version, EXT_PARSER_SRC ] do
|
347
337
|
sh "sdoc -o doc -t '#{PKG_TITLE}' -m README.rdoc README.rdoc lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.6
|
@@ -852,6 +852,21 @@ static VALUE cState_partial_generate(VALUE self, VALUE obj)
|
|
852
852
|
return fbuffer_to_s(buffer);
|
853
853
|
}
|
854
854
|
|
855
|
+
/*
|
856
|
+
* This function returns true if string is either a JSON array or JSON object.
|
857
|
+
* It might suffer from false positives, e. g. syntactically incorrect JSON in
|
858
|
+
* the string or certain UTF-8 characters on the right hand side.
|
859
|
+
*/
|
860
|
+
static int isArrayOrObject(VALUE string)
|
861
|
+
{
|
862
|
+
long string_len = RSTRING_LEN(string);
|
863
|
+
char c, *p = RSTRING_PTR(string), *q = p + string_len - 1;
|
864
|
+
if (string_len < 2) return 0;
|
865
|
+
for (; p < q && isspace(*p); p++);
|
866
|
+
for (; q > p && isspace(*q); q--);
|
867
|
+
return *p == '[' && *q == ']' || *p == '{' && *q == '}';
|
868
|
+
}
|
869
|
+
|
855
870
|
/*
|
856
871
|
* call-seq: generate(obj)
|
857
872
|
*
|
@@ -862,15 +877,9 @@ static VALUE cState_partial_generate(VALUE self, VALUE obj)
|
|
862
877
|
static VALUE cState_generate(VALUE self, VALUE obj)
|
863
878
|
{
|
864
879
|
VALUE result = cState_partial_generate(self, obj);
|
865
|
-
VALUE re, args[2];
|
866
880
|
GET_STATE(self);
|
867
|
-
if (!state->quirks_mode) {
|
868
|
-
|
869
|
-
args[1] = CRegexp_MULTILINE;
|
870
|
-
re = rb_class_new_instance(2, args, rb_cRegexp);
|
871
|
-
if (NIL_P(rb_funcall(re, i_match, 1, result))) {
|
872
|
-
rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed");
|
873
|
-
}
|
881
|
+
if (!state->quirks_mode && !isArrayOrObject(result)) {
|
882
|
+
rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed");
|
874
883
|
}
|
875
884
|
return result;
|
876
885
|
}
|
data/install.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'rbconfig'
|
4
3
|
require 'fileutils'
|
5
4
|
include FileUtils::Verbose
|
6
|
-
|
7
|
-
include
|
5
|
+
require 'rbconfig'
|
6
|
+
include\
|
7
|
+
begin
|
8
|
+
RbConfig
|
9
|
+
rescue NameError
|
10
|
+
Config
|
11
|
+
end
|
8
12
|
|
9
13
|
sitelibdir = CONFIG["sitelibdir"]
|
10
14
|
cd 'lib' do
|
@@ -31,6 +31,7 @@ final class StringDecoder extends ByteListTranscoder {
|
|
31
31
|
|
32
32
|
ByteList decode(ByteList src, int start, int end) {
|
33
33
|
ByteList out = new ByteList(end - start);
|
34
|
+
out.setEncoding(src.getEncoding());
|
34
35
|
init(src, start, end, out);
|
35
36
|
while (hasNext()) {
|
36
37
|
handleChar(readUtf8Char());
|
data/json.gemspec
CHANGED
@@ -2,39 +2,36 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "json"
|
5
|
-
s.version = "1.6.
|
5
|
+
s.version = "1.6.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-03-26"
|
10
10
|
s.description = "This is a JSON implementation as a Ruby extension in C."
|
11
11
|
s.email = "flori@ping.de"
|
12
|
-
s.extensions = ["ext/json/ext/
|
12
|
+
s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
|
13
13
|
s.extra_rdoc_files = ["README.rdoc"]
|
14
|
-
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "
|
14
|
+
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
|
15
15
|
s.homepage = "http://flori.github.com/json"
|
16
16
|
s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["ext/json/ext", "ext", "lib"]
|
18
18
|
s.rubyforge_project = "json"
|
19
|
-
s.rubygems_version = "1.8.
|
19
|
+
s.rubygems_version = "1.8.21"
|
20
20
|
s.summary = "JSON Implementation for Ruby"
|
21
|
-
s.test_files = ["./tests/
|
21
|
+
s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 3
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
27
|
s.add_development_dependency(%q<permutation>, [">= 0"])
|
28
|
-
s.add_development_dependency(%q<bullshit>, [">= 0"])
|
29
28
|
s.add_development_dependency(%q<sdoc>, [">= 0"])
|
30
29
|
else
|
31
30
|
s.add_dependency(%q<permutation>, [">= 0"])
|
32
|
-
s.add_dependency(%q<bullshit>, [">= 0"])
|
33
31
|
s.add_dependency(%q<sdoc>, [">= 0"])
|
34
32
|
end
|
35
33
|
else
|
36
34
|
s.add_dependency(%q<permutation>, [">= 0"])
|
37
|
-
s.add_dependency(%q<bullshit>, [">= 0"])
|
38
35
|
s.add_dependency(%q<sdoc>, [">= 0"])
|
39
36
|
end
|
40
37
|
end
|
data/json_pure.gemspec
CHANGED
@@ -2,40 +2,37 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "json_pure"
|
5
|
-
s.version = "1.6.
|
5
|
+
s.version = "1.6.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-03-26"
|
10
10
|
s.description = "This is a JSON implementation in pure Ruby."
|
11
11
|
s.email = "flori@ping.de"
|
12
12
|
s.extra_rdoc_files = ["README.rdoc"]
|
13
|
-
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "
|
13
|
+
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
|
14
14
|
s.homepage = "http://flori.github.com/json"
|
15
15
|
s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "json"
|
18
|
-
s.rubygems_version = "1.8.
|
18
|
+
s.rubygems_version = "1.8.21"
|
19
19
|
s.summary = "JSON Implementation for Ruby"
|
20
|
-
s.test_files = ["./tests/
|
20
|
+
s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
26
|
s.add_development_dependency(%q<permutation>, [">= 0"])
|
27
|
-
s.add_development_dependency(%q<bullshit>, [">= 0"])
|
28
27
|
s.add_development_dependency(%q<sdoc>, [">= 0"])
|
29
28
|
s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
|
30
29
|
else
|
31
30
|
s.add_dependency(%q<permutation>, [">= 0"])
|
32
|
-
s.add_dependency(%q<bullshit>, [">= 0"])
|
33
31
|
s.add_dependency(%q<sdoc>, [">= 0"])
|
34
32
|
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
35
33
|
end
|
36
34
|
else
|
37
35
|
s.add_dependency(%q<permutation>, [">= 0"])
|
38
|
-
s.add_dependency(%q<bullshit>, [">= 0"])
|
39
36
|
s.add_dependency(%q<sdoc>, [">= 0"])
|
40
37
|
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
41
38
|
end
|
data/lib/json/pure/generator.rb
CHANGED
@@ -255,8 +255,12 @@ module JSON
|
|
255
255
|
# GeneratorError exception.
|
256
256
|
def generate(obj)
|
257
257
|
result = obj.to_json(self)
|
258
|
-
|
259
|
-
|
258
|
+
unless @quirks_mode
|
259
|
+
unless result =~ /\A\s*\[/ && result =~ /\]\s*\Z/ ||
|
260
|
+
result =~ /\A\s*\{/ && result =~ /\}\s*\Z/
|
261
|
+
then
|
262
|
+
raise GeneratorError, "only generation of JSON objects or arrays allowed"
|
263
|
+
end
|
260
264
|
end
|
261
265
|
result
|
262
266
|
end
|
data/lib/json/version.rb
CHANGED
data/tests/test_json.rb
CHANGED
@@ -314,7 +314,7 @@ class TC_JSON < Test::Unit::TestCase
|
|
314
314
|
assert res.item_set?
|
315
315
|
end
|
316
316
|
|
317
|
-
def
|
317
|
+
def test_generate_core_subclasses_with_new_to_json
|
318
318
|
obj = SubHash2["foo" => SubHash2["bar" => true]]
|
319
319
|
obj_json = JSON(obj)
|
320
320
|
obj_again = JSON(obj_json)
|
@@ -325,12 +325,12 @@ class TC_JSON < Test::Unit::TestCase
|
|
325
325
|
assert_equal ["foo"], JSON(JSON(SubArray2["foo"]))
|
326
326
|
end
|
327
327
|
|
328
|
-
def
|
328
|
+
def test_generate_core_subclasses_with_default_to_json
|
329
329
|
assert_equal '{"foo":"bar"}', JSON(SubHash["foo" => "bar"])
|
330
330
|
assert_equal '["foo"]', JSON(SubArray["foo"])
|
331
331
|
end
|
332
332
|
|
333
|
-
def
|
333
|
+
def test_generate_of_core_subclasses
|
334
334
|
obj = SubHash["foo" => SubHash["bar" => true]]
|
335
335
|
obj_json = JSON(obj)
|
336
336
|
obj_again = JSON(obj_json)
|