File tree 4 files changed +14
-6
lines changed
4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 2
2
unless defined? ( ::JSON ::JSON_LOADED ) and ::JSON ::JSON_LOADED
3
3
require 'json'
4
4
end
5
- require 'ostruct'
5
+ begin
6
+ require 'ostruct'
7
+ rescue LoadError
8
+ end
6
9
7
10
class OpenStruct
8
11
@@ -48,4 +51,4 @@ def as_json(*)
48
51
def to_json ( *args )
49
52
as_json . to_json ( *args )
50
53
end
51
- end
54
+ end if defined? ( :: OpenStruct )
Original file line number Diff line number Diff line change 1
1
#frozen_string_literal: false
2
2
require 'json/version'
3
- require 'json/generic_object'
4
3
5
4
module JSON
5
+ autoload :GenericObject , 'json/generic_object'
6
+
6
7
NOT_SET = Object . new . freeze
7
8
private_constant :NOT_SET
8
9
Original file line number Diff line number Diff line change 1
1
#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
3
7
4
8
module JSON
5
9
class GenericObject < OpenStruct
@@ -67,5 +71,5 @@ def as_json(*)
67
71
def to_json ( *a )
68
72
as_json . to_json ( *a )
69
73
end
70
- end
74
+ end if defined? ( :: OpenStruct )
71
75
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: false
2
2
module JSON
3
3
# JSON version
4
- VERSION = '2.7.1 '
4
+ VERSION = '2.7.2 '
5
5
VERSION_ARRAY = VERSION . split ( /\. / ) . map { |x | x . to_i } # :nodoc:
6
6
VERSION_MAJOR = VERSION_ARRAY [ 0 ] # :nodoc:
7
7
VERSION_MINOR = VERSION_ARRAY [ 1 ] # :nodoc:
You can’t perform that action at this time.
0 commit comments