json 1.8.3 → 1.8.5
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +5 -13
- data/CHANGES +9 -0
- data/Gemfile +1 -4
- data/{README.rdoc → README.md} +31 -44
- data/Rakefile +10 -20
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +38 -4
- data/ext/json/ext/generator/generator.h +7 -0
- data/ext/json/ext/parser/parser.c +166 -142
- data/ext/json/ext/parser/parser.rl +52 -28
- data/java/src/json/ext/ByteListTranscoder.java +1 -2
- data/java/src/json/ext/Generator.java +9 -7
- data/java/src/json/ext/GeneratorMethods.java +1 -2
- data/java/src/json/ext/GeneratorService.java +1 -2
- data/java/src/json/ext/GeneratorState.java +1 -2
- data/java/src/json/ext/OptionsReader.java +1 -2
- data/java/src/json/ext/Parser.java +1 -2
- data/java/src/json/ext/Parser.rl +1 -2
- data/java/src/json/ext/ParserService.java +1 -2
- data/java/src/json/ext/RuntimeInfo.java +1 -2
- data/java/src/json/ext/StringDecoder.java +1 -2
- data/java/src/json/ext/StringEncoder.java +5 -0
- data/java/src/json/ext/Utils.java +1 -2
- data/json-java.gemspec +15 -0
- data/json.gemspec +0 -0
- data/json_pure.gemspec +23 -26
- data/lib/json/pure/generator.rb +10 -2
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +0 -34
- data/tests/test_json_generate.rb +11 -0
- data/tools/diff.sh +18 -0
- metadata +11 -13
- data/COPYING +0 -58
- data/COPYING-json-jruby +0 -57
- data/GPL +0 -340
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ab2768f17ffed4013aab3fb606c07581e91ae56
|
4
|
+
data.tar.gz: 87c506de4cf87feafa319b163c1a6d9003f55560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94fdb049e1ab68c581c476dbeb2c1fa2d2254ae48637a9e60c8adbe307651ac129a3ea8c12dd2793db1f74dde88e5e745aeb4fdce3ec01584b62d6cd2a9c6b3f
|
7
|
+
data.tar.gz: ce9f3d42f35845b76d23ea8614907853413629e8e0293bd404884936cfec42a5194669ae109aa9f7ca09692001361f328402b02054097a470ebe921ade151760
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -4,23 +4,15 @@ language: ruby
|
|
4
4
|
|
5
5
|
# Specify which ruby versions you wish to run your tests on, each version will be used
|
6
6
|
rvm:
|
7
|
-
- 1.8.7
|
8
|
-
- 1.9.2
|
9
7
|
- 1.9.3
|
10
8
|
- 2.0.0
|
11
9
|
- 2.1
|
12
|
-
- 2.2.1
|
13
|
-
- 2.2.2
|
14
10
|
- 2.2
|
15
|
-
-
|
16
|
-
-
|
17
|
-
- jruby-18mode
|
18
|
-
- jruby-19mode
|
19
|
-
- ruby-head
|
11
|
+
- 2.3.3
|
12
|
+
- 2.4.0
|
20
13
|
matrix:
|
21
|
-
|
22
|
-
- rvm:
|
23
|
-
|
14
|
+
include:
|
15
|
+
- rvm: jruby
|
16
|
+
env: JRUBY_OPTS="--2.0"
|
24
17
|
script: "bundle exec rake"
|
25
|
-
|
26
18
|
sudo: false
|
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
2015-09-11 (1.8.5)
|
2
|
+
* There were still some mentions of dual GPL licensing in the source, but JSON
|
3
|
+
has just the Ruby license that itself includes an explicit dual-licensing
|
4
|
+
clause that allows covered software to be distributed under the terms of
|
5
|
+
the Simplified BSD License instead for all ruby versions >= 1.9.3. This is
|
6
|
+
however a GPL compatible license according to the Free Software Foundation.
|
7
|
+
I changed these mentions to be consistent with the Ruby license setting in
|
8
|
+
the gemspec files which were already correct now.
|
9
|
+
---------- (1.8.4) Skipped.
|
1
10
|
2015-06-01 (1.8.3)
|
2
11
|
* Fix potential memory leak, thx to nobu.
|
3
12
|
2015-01-08 (1.8.2)
|
data/Gemfile
CHANGED
data/{README.rdoc → README.md}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
# JSON implementation for Ruby {<img src="https://secure.travis-ci.org/flori/json.png" />}[http://travis-ci.org/flori/json]
|
2
2
|
|
3
|
-
|
3
|
+
## Description
|
4
4
|
|
5
5
|
This is a implementation of the JSON specification according to RFC 4627
|
6
6
|
http://www.ietf.org/rfc/rfc4627.txt . Starting from version 1.0.0 on there
|
@@ -11,17 +11,17 @@ will be two variants available:
|
|
11
11
|
* The quite a bit faster native extension variant, which is in parts
|
12
12
|
implemented in C or Java and comes with its own unicode conversion
|
13
13
|
functions and a parser generated by the ragel state machine compiler
|
14
|
-
http://www.
|
14
|
+
http://www.complang.org/ragel/ .
|
15
15
|
|
16
16
|
Both variants of the JSON generator generate UTF-8 character sequences by
|
17
|
-
default. If an :
|
17
|
+
default. If an :ascii\_only option with a true value is given, they escape all
|
18
18
|
non-ASCII and control characters with \uXXXX escape sequences, and support
|
19
19
|
UTF-16 surrogate pairs in order to be able to generate the whole range of
|
20
20
|
unicode code points.
|
21
21
|
|
22
22
|
All strings, that are to be encoded as JSON strings, should be UTF-8 byte
|
23
23
|
sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
|
24
|
-
encoded, please use the
|
24
|
+
encoded, please use the to\_json\_raw\_object method of String (which produces
|
25
25
|
an object, that contains a byte array) and decode the result on the receiving
|
26
26
|
endpoint.
|
27
27
|
|
@@ -32,7 +32,7 @@ String#encoding set. If a document string has ASCII-8BIT as an encoding the
|
|
32
32
|
parser attempts to figure out which of the UTF encodings from above it is and
|
33
33
|
trys to parse it.
|
34
34
|
|
35
|
-
|
35
|
+
## Installation
|
36
36
|
|
37
37
|
It's recommended to use the extension variant of JSON, because it's faster than
|
38
38
|
the pure ruby variant. If you cannot build it on your system, you can settle
|
@@ -63,29 +63,18 @@ with:
|
|
63
63
|
|
64
64
|
# gem install json_pure
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
If you want to build the extensions yourself you need rake:
|
69
|
-
|
70
|
-
You can get it from rubyforge:
|
71
|
-
http://rubyforge.org/projects/rake
|
72
|
-
|
73
|
-
or just type
|
74
|
-
|
75
|
-
# gem install rake
|
76
|
-
|
77
|
-
for the installation via rubygems.
|
66
|
+
## Compiling the extensions yourself
|
78
67
|
|
79
68
|
If you want to create the parser.c file from its parser.rl file or draw nice
|
80
|
-
graphviz images of the state machines, you need ragel from:
|
81
|
-
|
69
|
+
graphviz images of the state machines, you need ragel from:
|
70
|
+
http://www.complang.org/ragel/
|
82
71
|
|
83
|
-
|
72
|
+
## Usage
|
84
73
|
|
85
74
|
To use JSON you can
|
86
75
|
require 'json'
|
87
76
|
to load the installed variant (either the extension 'json' or the pure
|
88
|
-
variant '
|
77
|
+
variant 'json\_pure'). If you have installed the extension variant, you can
|
89
78
|
pick either the extension variant or the pure variant by typing
|
90
79
|
require 'json/ext'
|
91
80
|
or
|
@@ -98,8 +87,8 @@ Now you can parse a JSON document into a ruby data structure by calling
|
|
98
87
|
If you want to generate a JSON document from a ruby data structure call
|
99
88
|
JSON.generate(data)
|
100
89
|
|
101
|
-
You can also use the
|
102
|
-
verbosely and nicely) or
|
90
|
+
You can also use the pretty\_generate method (which formats the output more
|
91
|
+
verbosely and nicely) or fast\_generate (which doesn't do any of the security
|
103
92
|
checks generate performs, e. g. nesting deepness checks).
|
104
93
|
|
105
94
|
To create a valid JSON document you have to make sure, that the output is
|
@@ -134,7 +123,7 @@ To get the best compatibility to rails' JSON implementation, you can
|
|
134
123
|
Both of the additions attempt to require 'json' (like above) first, if it has
|
135
124
|
not been required yet.
|
136
125
|
|
137
|
-
|
126
|
+
## More Examples
|
138
127
|
|
139
128
|
To create a JSON document from a ruby data structure, you can call
|
140
129
|
JSON.generate like that:
|
@@ -151,11 +140,11 @@ JSON.parse on it:
|
|
151
140
|
Note, that the range from the original data structure is a simple
|
152
141
|
string now. The reason for this is, that JSON doesn't support ranges
|
153
142
|
or arbitrary classes. In this case the json library falls back to call
|
154
|
-
Object#
|
143
|
+
Object#to\_json, which is the same as #to\_s.to\_json.
|
155
144
|
|
156
145
|
It's possible to add JSON support serialization to arbitrary classes by
|
157
|
-
simply implementing a more specialized version of the #
|
158
|
-
should return a JSON object (a hash converted to JSON with #
|
146
|
+
simply implementing a more specialized version of the #to\_json method, that
|
147
|
+
should return a JSON object (a hash converted to JSON with #to\_json) like
|
159
148
|
this (don't forget the *a for all the arguments):
|
160
149
|
|
161
150
|
class Range
|
@@ -167,15 +156,15 @@ this (don't forget the *a for all the arguments):
|
|
167
156
|
end
|
168
157
|
end
|
169
158
|
|
170
|
-
The hash key '
|
159
|
+
The hash key 'json\_class' is the class, that will be asked to deserialise the
|
171
160
|
JSON representation later. In this case it's 'Range', but any namespace of
|
172
161
|
the form 'A::B' or '::A::B' will do. All other keys are arbitrary and can be
|
173
162
|
used to store the necessary data to configure the object to be deserialised.
|
174
163
|
|
175
|
-
If a the key '
|
176
|
-
if the given class responds to the
|
164
|
+
If a the key 'json\_class' is found in a JSON object, the JSON parser checks
|
165
|
+
if the given class responds to the json\_create class method. If so, it is
|
177
166
|
called with the JSON object converted to a Ruby hash. So a range can
|
178
|
-
be deserialised by implementing Range.
|
167
|
+
be deserialised by implementing Range.json\_create like this:
|
179
168
|
|
180
169
|
class Range
|
181
170
|
def self.json_create(o)
|
@@ -193,7 +182,7 @@ Now it possible to serialise/deserialise ranges as well:
|
|
193
182
|
JSON.generate always creates the shortest possible string representation of a
|
194
183
|
ruby data structure in one line. This is good for data storage or network
|
195
184
|
protocols, but not so good for humans to read. Fortunately there's also
|
196
|
-
JSON.
|
185
|
+
JSON.pretty\_generate (or JSON.pretty\_generate) that creates a more readable
|
197
186
|
output:
|
198
187
|
|
199
188
|
puts JSON.pretty_generate([1, 2, {"a"=>3.141}, false, true, nil, 4..10])
|
@@ -217,14 +206,14 @@ output:
|
|
217
206
|
]
|
218
207
|
|
219
208
|
There are also the methods Kernel#j for generate, and Kernel#jj for
|
220
|
-
|
209
|
+
pretty\_generate output to the console, that work analogous to Core Ruby's p and
|
221
210
|
the pp library's pp methods.
|
222
211
|
|
223
212
|
The script tools/server.rb contains a small example if you want to test, how
|
224
213
|
receiving a JSON object from a webrick server in your browser with the
|
225
214
|
javasript prototype library http://www.prototypejs.org works.
|
226
215
|
|
227
|
-
|
216
|
+
## Speed Comparisons
|
228
217
|
|
229
218
|
I have created some benchmark results (see the benchmarks/data-p4-3Ghz
|
230
219
|
subdir of the package) for the JSON-parser to estimate the speed up in the C
|
@@ -303,10 +292,10 @@ speed:
|
|
303
292
|
|
304
293
|
In the table above 1-3 are JSON::Ext::Generator methods. 4, 6, and 7 are
|
305
294
|
JSON::Pure::Generator methods and 5 is the Rails JSON generator. It is now a
|
306
|
-
bit faster than the
|
295
|
+
bit faster than the generator\_safe and generator\_pretty methods of the pure
|
307
296
|
variant but slower than the others.
|
308
297
|
|
309
|
-
To achieve the fastest JSON document output, you can use the
|
298
|
+
To achieve the fastest JSON document output, you can use the fast\_generate
|
310
299
|
method. Beware, that this will disable the checking for circular Ruby data
|
311
300
|
structures, which may cause JSON to go into an infinite loop.
|
312
301
|
|
@@ -337,21 +326,19 @@ Here are the median comparisons for completeness' sake:
|
|
337
326
|
calls/sec ( time) -> speed covers
|
338
327
|
secs/call
|
339
328
|
|
340
|
-
|
329
|
+
## Author
|
341
330
|
|
342
331
|
Florian Frank <mailto:flori@ping.de>
|
343
332
|
|
344
|
-
|
333
|
+
## License
|
345
334
|
|
346
|
-
Ruby License, see
|
347
|
-
Ruby License includes the GNU General Public License (GPL), Version 2, so see
|
348
|
-
the file GPL as well.
|
335
|
+
Ruby License, see https://www.ruby-lang.org/en/about/license.txt.
|
349
336
|
|
350
|
-
|
337
|
+
## Download
|
351
338
|
|
352
339
|
The latest version of this library can be downloaded at
|
353
340
|
|
354
|
-
*
|
341
|
+
* https://rubygems.org/gems/json
|
355
342
|
|
356
343
|
Online Documentation should be located at
|
357
344
|
|
data/Rakefile
CHANGED
@@ -23,10 +23,6 @@ class UndocumentedTestTask < Rake::TestTask
|
|
23
23
|
def desc(*) end
|
24
24
|
end
|
25
25
|
|
26
|
-
def skip_sdoc(src)
|
27
|
-
src.gsub(/^.*sdoc.*/) { |s| s + ' if RUBY_VERSION > "1.8.6"' }
|
28
|
-
end
|
29
|
-
|
30
26
|
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
|
31
27
|
BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
|
32
28
|
PKG_NAME = 'json'
|
@@ -87,13 +83,12 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
87
83
|
s.files = PKG_FILES
|
88
84
|
|
89
85
|
s.require_path = 'lib'
|
90
|
-
s.add_development_dependency '
|
91
|
-
s.add_development_dependency '
|
92
|
-
s.add_development_dependency 'rake', '~>0.9.2'
|
86
|
+
s.add_development_dependency 'rake'
|
87
|
+
s.add_development_dependency 'test-unit', '~> 2.0'
|
93
88
|
|
94
|
-
s.extra_rdoc_files << 'README.
|
89
|
+
s.extra_rdoc_files << 'README.md'
|
95
90
|
s.rdoc_options <<
|
96
|
-
'--title' << 'JSON implemention for
|
91
|
+
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
|
97
92
|
s.test_files.concat Dir['./tests/test_*.rb']
|
98
93
|
|
99
94
|
s.author = "Florian Frank"
|
@@ -105,7 +100,7 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
105
100
|
desc 'Creates a json_pure.gemspec file'
|
106
101
|
task :gemspec_pure => :version do
|
107
102
|
File.open('json_pure.gemspec', 'w') do |gemspec|
|
108
|
-
gemspec.write
|
103
|
+
gemspec.write spec_pure.to_ruby
|
109
104
|
end
|
110
105
|
end
|
111
106
|
|
@@ -125,12 +120,12 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
125
120
|
s.extensions = FileList['ext/**/extconf.rb']
|
126
121
|
|
127
122
|
s.require_path = 'lib'
|
128
|
-
s.add_development_dependency '
|
129
|
-
s.add_development_dependency '
|
123
|
+
s.add_development_dependency 'rake'
|
124
|
+
s.add_development_dependency 'test-unit', '~> 2.0'
|
130
125
|
|
131
|
-
s.extra_rdoc_files << 'README.
|
126
|
+
s.extra_rdoc_files << 'README.md'
|
132
127
|
s.rdoc_options <<
|
133
|
-
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.
|
128
|
+
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
|
134
129
|
s.test_files.concat Dir['./tests/test_*.rb']
|
135
130
|
|
136
131
|
s.author = "Florian Frank"
|
@@ -142,7 +137,7 @@ if defined?(Gem) and defined?(Gem::PackageTask)
|
|
142
137
|
desc 'Creates a json.gemspec file'
|
143
138
|
task :gemspec_ext => :version do
|
144
139
|
File.open('json.gemspec', 'w') do |gemspec|
|
145
|
-
gemspec.write
|
140
|
+
gemspec.write spec_ext.to_ruby
|
146
141
|
end
|
147
142
|
end
|
148
143
|
|
@@ -341,11 +336,6 @@ else
|
|
341
336
|
t.options = '-v'
|
342
337
|
end
|
343
338
|
|
344
|
-
desc "Create RDOC documentation"
|
345
|
-
task :doc => [ :version, EXT_PARSER_SRC ] do
|
346
|
-
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}"
|
347
|
-
end
|
348
|
-
|
349
339
|
desc "Generate parser with ragel"
|
350
340
|
task :ragel => EXT_PARSER_SRC
|
351
341
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.5
|
@@ -7,7 +7,13 @@ static ID i_encoding, i_encode;
|
|
7
7
|
#endif
|
8
8
|
|
9
9
|
static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
|
10
|
-
mHash, mArray,
|
10
|
+
mHash, mArray,
|
11
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
12
|
+
mInteger,
|
13
|
+
#else
|
14
|
+
mFixnum, mBignum,
|
15
|
+
#endif
|
16
|
+
mFloat, mString, mString_Extend,
|
11
17
|
mTrueClass, mFalseClass, mNilClass, eGeneratorError,
|
12
18
|
eNestingError, CRegexp_MULTILINE, CJSON_SAFE_STATE_PROTOTYPE,
|
13
19
|
i_SAFE_STATE_PROTOTYPE;
|
@@ -342,6 +348,18 @@ static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self) {
|
|
342
348
|
GENERATE_JSON(array);
|
343
349
|
}
|
344
350
|
|
351
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
352
|
+
/*
|
353
|
+
* call-seq: to_json(*)
|
354
|
+
*
|
355
|
+
* Returns a JSON string representation for this Integer number.
|
356
|
+
*/
|
357
|
+
static VALUE mInteger_to_json(int argc, VALUE *argv, VALUE self)
|
358
|
+
{
|
359
|
+
GENERATE_JSON(integer);
|
360
|
+
}
|
361
|
+
|
362
|
+
#else
|
345
363
|
/*
|
346
364
|
* call-seq: to_json(*)
|
347
365
|
*
|
@@ -361,6 +379,7 @@ static VALUE mBignum_to_json(int argc, VALUE *argv, VALUE self)
|
|
361
379
|
{
|
362
380
|
GENERATE_JSON(bignum);
|
363
381
|
}
|
382
|
+
#endif
|
364
383
|
|
365
384
|
/*
|
366
385
|
* call-seq: to_json(*)
|
@@ -825,6 +844,16 @@ static void generate_json_bignum(FBuffer *buffer, VALUE Vstate, JSON_Generator_S
|
|
825
844
|
fbuffer_append_str(buffer, tmp);
|
826
845
|
}
|
827
846
|
|
847
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
848
|
+
static void generate_json_integer(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
|
849
|
+
{
|
850
|
+
if (FIXNUM_P(obj))
|
851
|
+
generate_json_fixnum(buffer, Vstate, state, obj);
|
852
|
+
else
|
853
|
+
generate_json_bignum(buffer, Vstate, state, obj);
|
854
|
+
}
|
855
|
+
#endif
|
856
|
+
|
828
857
|
static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
|
829
858
|
{
|
830
859
|
double value = RFLOAT_VALUE(obj);
|
@@ -858,9 +887,9 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
|
|
858
887
|
generate_json_false(buffer, Vstate, state, obj);
|
859
888
|
} else if (obj == Qtrue) {
|
860
889
|
generate_json_true(buffer, Vstate, state, obj);
|
861
|
-
} else if (
|
890
|
+
} else if (FIXNUM_P(obj)) {
|
862
891
|
generate_json_fixnum(buffer, Vstate, state, obj);
|
863
|
-
} else if (
|
892
|
+
} else if (RB_TYPE_P(obj, T_BIGNUM)) {
|
864
893
|
generate_json_bignum(buffer, Vstate, state, obj);
|
865
894
|
} else if (klass == rb_cFloat) {
|
866
895
|
generate_json_float(buffer, Vstate, state, obj);
|
@@ -871,7 +900,7 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
|
|
871
900
|
} else {
|
872
901
|
tmp = rb_funcall(obj, i_to_s, 0);
|
873
902
|
Check_Type(tmp, T_STRING);
|
874
|
-
|
903
|
+
generate_json_string(buffer, Vstate, state, tmp);
|
875
904
|
}
|
876
905
|
}
|
877
906
|
|
@@ -1402,10 +1431,15 @@ void Init_generator(void)
|
|
1402
1431
|
rb_define_method(mHash, "to_json", mHash_to_json, -1);
|
1403
1432
|
mArray = rb_define_module_under(mGeneratorMethods, "Array");
|
1404
1433
|
rb_define_method(mArray, "to_json", mArray_to_json, -1);
|
1434
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
1435
|
+
mInteger = rb_define_module_under(mGeneratorMethods, "Integer");
|
1436
|
+
rb_define_method(mInteger, "to_json", mInteger_to_json, -1);
|
1437
|
+
#else
|
1405
1438
|
mFixnum = rb_define_module_under(mGeneratorMethods, "Fixnum");
|
1406
1439
|
rb_define_method(mFixnum, "to_json", mFixnum_to_json, -1);
|
1407
1440
|
mBignum = rb_define_module_under(mGeneratorMethods, "Bignum");
|
1408
1441
|
rb_define_method(mBignum, "to_json", mBignum_to_json, -1);
|
1442
|
+
#endif
|
1409
1443
|
mFloat = rb_define_module_under(mGeneratorMethods, "Float");
|
1410
1444
|
rb_define_method(mFloat, "to_json", mFloat_to_json, -1);
|
1411
1445
|
mString = rb_define_module_under(mGeneratorMethods, "String");
|
@@ -99,8 +99,12 @@ typedef struct JSON_Generator_StateStruct {
|
|
99
99
|
|
100
100
|
static VALUE mHash_to_json(int argc, VALUE *argv, VALUE self);
|
101
101
|
static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self);
|
102
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
103
|
+
static VALUE mInteger_to_json(int argc, VALUE *argv, VALUE self);
|
104
|
+
#else
|
102
105
|
static VALUE mFixnum_to_json(int argc, VALUE *argv, VALUE self);
|
103
106
|
static VALUE mBignum_to_json(int argc, VALUE *argv, VALUE self);
|
107
|
+
#endif
|
104
108
|
static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self);
|
105
109
|
static VALUE mString_included_s(VALUE self, VALUE modul);
|
106
110
|
static VALUE mString_to_json(int argc, VALUE *argv, VALUE self);
|
@@ -122,6 +126,9 @@ static void generate_json_string(FBuffer *buffer, VALUE Vstate, JSON_Generator_S
|
|
122
126
|
static void generate_json_null(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
123
127
|
static void generate_json_false(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
124
128
|
static void generate_json_true(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
129
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
130
|
+
static void generate_json_integer(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
131
|
+
#endif
|
125
132
|
static void generate_json_fixnum(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
126
133
|
static void generate_json_bignum(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|
127
134
|
static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj);
|