json 2.7.2 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BSDL +22 -0
- data/CHANGES.md +73 -17
- data/LEGAL +60 -0
- data/README.md +15 -236
- data/ext/json/ext/fbuffer/fbuffer.h +76 -79
- data/ext/json/ext/generator/extconf.rb +8 -2
- data/ext/json/ext/generator/generator.c +776 -816
- data/ext/json/ext/parser/extconf.rb +7 -27
- data/ext/json/ext/parser/parser.c +1697 -670
- data/ext/json/ext/parser/parser.rl +832 -338
- data/json.gemspec +45 -49
- data/lib/json/add/bigdecimal.rb +2 -2
- data/lib/json/add/complex.rb +1 -1
- data/lib/json/add/core.rb +1 -1
- data/lib/json/add/date.rb +1 -1
- data/lib/json/add/date_time.rb +1 -1
- data/lib/json/add/exception.rb +1 -1
- data/lib/json/add/ostruct.rb +1 -1
- data/lib/json/add/range.rb +1 -1
- data/lib/json/add/rational.rb +1 -1
- data/lib/json/add/regexp.rb +1 -1
- data/lib/json/add/struct.rb +1 -1
- data/lib/json/add/symbol.rb +1 -2
- data/lib/json/add/time.rb +3 -10
- data/lib/json/common.rb +273 -95
- data/lib/json/ext/generator/state.rb +105 -0
- data/lib/json/ext.rb +13 -5
- data/lib/json/generic_object.rb +1 -1
- data/lib/json/{pure → truffle_ruby}/generator.rb +228 -120
- data/lib/json/version.rb +3 -7
- data/lib/json.rb +16 -21
- metadata +19 -21
- data/ext/json/ext/generator/depend +0 -1
- data/ext/json/ext/generator/generator.h +0 -177
- data/ext/json/ext/parser/depend +0 -1
- data/ext/json/ext/parser/parser.h +0 -96
- data/ext/json/extconf.rb +0 -3
- data/lib/json/pure/parser.rb +0 -337
- data/lib/json/pure.rb +0 -15
- /data/{LICENSE → COPYING} +0 -0
data/json.gemspec
CHANGED
@@ -1,68 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line|
|
2
4
|
/^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1
|
3
5
|
end rescue nil
|
4
6
|
|
5
|
-
Gem::Specification.new do |s|
|
7
|
+
spec = Gem::Specification.new do |s|
|
8
|
+
java_ext = Gem::Platform === s.platform && s.platform =~ 'java' || RUBY_ENGINE == 'jruby'
|
9
|
+
|
6
10
|
s.name = "json"
|
7
11
|
s.version = version
|
8
12
|
|
9
13
|
s.summary = "JSON Implementation for Ruby"
|
10
|
-
s.
|
14
|
+
s.homepage = "https://ruby.github.io/json"
|
15
|
+
s.metadata = {
|
16
|
+
'bug_tracker_uri' => 'https://github.com/ruby/json/issues',
|
17
|
+
'changelog_uri' => 'https://github.com/ruby/json/blob/master/CHANGES.md',
|
18
|
+
'documentation_uri' => 'https://ruby.github.io/json/doc/index.html',
|
19
|
+
'homepage_uri' => s.homepage,
|
20
|
+
'source_code_uri' => 'https://github.com/ruby/json',
|
21
|
+
'wiki_uri' => 'https://github.com/ruby/json/wiki'
|
22
|
+
}
|
23
|
+
|
24
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.7")
|
25
|
+
|
26
|
+
if java_ext
|
27
|
+
s.description = "A JSON implementation as a JRuby extension."
|
28
|
+
s.author = "Daniel Luz"
|
29
|
+
s.email = "dev+ruby@mernen.com"
|
30
|
+
else
|
31
|
+
s.description = "This is a JSON implementation as a Ruby extension in C."
|
32
|
+
s.authors = ["Florian Frank"]
|
33
|
+
s.email = "flori@ping.de"
|
34
|
+
end
|
35
|
+
|
11
36
|
s.licenses = ["Ruby"]
|
12
|
-
s.authors = ["Florian Frank"]
|
13
|
-
s.email = "flori@ping.de"
|
14
37
|
|
15
|
-
s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb", "ext/json/extconf.rb"]
|
16
38
|
s.extra_rdoc_files = ["README.md"]
|
17
39
|
s.rdoc_options = ["--title", "JSON implementation for Ruby", "--main", "README.md"]
|
40
|
+
|
18
41
|
s.files = [
|
19
42
|
"CHANGES.md",
|
20
|
-
"
|
43
|
+
"COPYING",
|
44
|
+
"BSDL",
|
45
|
+
"LEGAL",
|
21
46
|
"README.md",
|
22
|
-
"ext/json/ext/fbuffer/fbuffer.h",
|
23
|
-
"ext/json/ext/generator/depend",
|
24
|
-
"ext/json/ext/generator/extconf.rb",
|
25
|
-
"ext/json/ext/generator/generator.c",
|
26
|
-
"ext/json/ext/generator/generator.h",
|
27
|
-
"ext/json/ext/parser/depend",
|
28
|
-
"ext/json/ext/parser/extconf.rb",
|
29
|
-
"ext/json/ext/parser/parser.c",
|
30
|
-
"ext/json/ext/parser/parser.h",
|
31
|
-
"ext/json/ext/parser/parser.rl",
|
32
|
-
"ext/json/extconf.rb",
|
33
47
|
"json.gemspec",
|
34
|
-
"lib
|
35
|
-
"lib/json/add/bigdecimal.rb",
|
36
|
-
"lib/json/add/complex.rb",
|
37
|
-
"lib/json/add/core.rb",
|
38
|
-
"lib/json/add/date.rb",
|
39
|
-
"lib/json/add/date_time.rb",
|
40
|
-
"lib/json/add/exception.rb",
|
41
|
-
"lib/json/add/ostruct.rb",
|
42
|
-
"lib/json/add/range.rb",
|
43
|
-
"lib/json/add/rational.rb",
|
44
|
-
"lib/json/add/regexp.rb",
|
45
|
-
"lib/json/add/set.rb",
|
46
|
-
"lib/json/add/struct.rb",
|
47
|
-
"lib/json/add/symbol.rb",
|
48
|
-
"lib/json/add/time.rb",
|
49
|
-
"lib/json/common.rb",
|
50
|
-
"lib/json/ext.rb",
|
51
|
-
"lib/json/generic_object.rb",
|
52
|
-
"lib/json/pure.rb",
|
53
|
-
"lib/json/pure/generator.rb",
|
54
|
-
"lib/json/pure/parser.rb",
|
55
|
-
"lib/json/version.rb",
|
48
|
+
*Dir["lib/**/*.rb"],
|
56
49
|
]
|
57
|
-
s.homepage = "https://flori.github.io/json"
|
58
|
-
s.metadata = {
|
59
|
-
'bug_tracker_uri' => 'https://github.com/flori/json/issues',
|
60
|
-
'changelog_uri' => 'https://github.com/flori/json/blob/master/CHANGES.md',
|
61
|
-
'documentation_uri' => 'https://flori.github.io/json/doc/index.html',
|
62
|
-
'homepage_uri' => s.homepage,
|
63
|
-
'source_code_uri' => 'https://github.com/flori/json',
|
64
|
-
'wiki_uri' => 'https://github.com/flori/json/wiki'
|
65
|
-
}
|
66
50
|
|
67
|
-
|
51
|
+
if java_ext
|
52
|
+
s.platform = 'java'
|
53
|
+
s.files += Dir["lib/json/ext/**/*.jar"]
|
54
|
+
else
|
55
|
+
s.extensions = Dir["ext/json/**/extconf.rb"]
|
56
|
+
s.files += Dir["ext/json/**/*.{c,h,rl}"]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if RUBY_ENGINE == 'jruby' && $0 == __FILE__
|
61
|
+
Gem::Builder.new(spec).build
|
62
|
+
else
|
63
|
+
spec
|
68
64
|
end
|
data/lib/json/add/bigdecimal.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
|
3
3
|
require 'json'
|
4
4
|
end
|
@@ -35,7 +35,7 @@ class BigDecimal
|
|
35
35
|
def as_json(*)
|
36
36
|
{
|
37
37
|
JSON.create_id => self.class.name,
|
38
|
-
'b' => _dump,
|
38
|
+
'b' => _dump.force_encoding(Encoding::UTF_8),
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
data/lib/json/add/complex.rb
CHANGED
data/lib/json/add/core.rb
CHANGED
data/lib/json/add/date.rb
CHANGED
data/lib/json/add/date_time.rb
CHANGED
data/lib/json/add/exception.rb
CHANGED
data/lib/json/add/ostruct.rb
CHANGED
data/lib/json/add/range.rb
CHANGED
data/lib/json/add/rational.rb
CHANGED
data/lib/json/add/regexp.rb
CHANGED
data/lib/json/add/struct.rb
CHANGED
data/lib/json/add/symbol.rb
CHANGED
data/lib/json/add/time.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
|
3
3
|
require 'json'
|
4
4
|
end
|
@@ -10,11 +10,7 @@ class Time
|
|
10
10
|
if usec = object.delete('u') # used to be tv_usec -> tv_nsec
|
11
11
|
object['n'] = usec * 1000
|
12
12
|
end
|
13
|
-
|
14
|
-
at(object['s'], Rational(object['n'], 1000))
|
15
|
-
else
|
16
|
-
at(object['s'], object['n'] / 1000)
|
17
|
-
end
|
13
|
+
at(object['s'], Rational(object['n'], 1000))
|
18
14
|
end
|
19
15
|
|
20
16
|
# Methods <tt>Time#as_json</tt> and +Time.json_create+ may be used
|
@@ -34,13 +30,10 @@ class Time
|
|
34
30
|
# # => 2023-11-25 11:00:56.472846644 -0600
|
35
31
|
#
|
36
32
|
def as_json(*)
|
37
|
-
nanoseconds = [ tv_usec * 1000 ]
|
38
|
-
respond_to?(:tv_nsec) and nanoseconds << tv_nsec
|
39
|
-
nanoseconds = nanoseconds.max
|
40
33
|
{
|
41
34
|
JSON.create_id => self.class.name,
|
42
35
|
's' => tv_sec,
|
43
|
-
'n' =>
|
36
|
+
'n' => tv_nsec,
|
44
37
|
}
|
45
38
|
end
|
46
39
|
|