Skip to content

Commit 079eac0

Browse files
committed
Upgrade json to 2.7.2
1 parent d2798ff commit 079eac0

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

lib/json/lib/json/add/ostruct.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
33
require 'json'
44
end
5-
require 'ostruct'
5+
begin
6+
require 'ostruct'
7+
rescue LoadError
8+
end
69

710
class OpenStruct
811

@@ -48,4 +51,4 @@ def as_json(*)
4851
def to_json(*args)
4952
as_json.to_json(*args)
5053
end
51-
end
54+
end if defined?(::OpenStruct)

lib/json/lib/json/common.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#frozen_string_literal: false
22
require 'json/version'
3-
require 'json/generic_object'
43

54
module JSON
5+
autoload :GenericObject, 'json/generic_object'
6+
67
NOT_SET = Object.new.freeze
78
private_constant :NOT_SET
89

lib/json/lib/json/generic_object.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#frozen_string_literal: false
2-
require 'ostruct'
2+
begin
3+
require 'ostruct'
4+
rescue LoadError
5+
warn "JSON::GenericObject requires 'ostruct'. Please install it with `gem install ostruct`."
6+
end
37

48
module JSON
59
class GenericObject < OpenStruct
@@ -67,5 +71,5 @@ def as_json(*)
6771
def to_json(*a)
6872
as_json.to_json(*a)
6973
end
70-
end
74+
end if defined?(::OpenStruct)
7175
end

lib/json/lib/json/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22
module JSON
33
# JSON version
4-
VERSION = '2.7.1'
4+
VERSION = '2.7.2'
55
VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
66
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
77
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:

0 commit comments

Comments
 (0)