json-ld 3.2.3 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/json/ld/api.rb +807 -764
  4. data/lib/json/ld/compact.rb +304 -304
  5. data/lib/json/ld/conneg.rb +179 -161
  6. data/lib/json/ld/context.rb +2080 -1945
  7. data/lib/json/ld/expand.rb +745 -666
  8. data/lib/json/ld/extensions.rb +14 -13
  9. data/lib/json/ld/flatten.rb +257 -247
  10. data/lib/json/ld/format.rb +202 -194
  11. data/lib/json/ld/frame.rb +525 -502
  12. data/lib/json/ld/from_rdf.rb +224 -166
  13. data/lib/json/ld/html/nokogiri.rb +123 -121
  14. data/lib/json/ld/html/rexml.rb +151 -147
  15. data/lib/json/ld/reader.rb +107 -100
  16. data/lib/json/ld/resource.rb +224 -205
  17. data/lib/json/ld/streaming_reader.rb +574 -507
  18. data/lib/json/ld/streaming_writer.rb +93 -92
  19. data/lib/json/ld/to_rdf.rb +171 -167
  20. data/lib/json/ld/utils.rb +270 -264
  21. data/lib/json/ld/version.rb +24 -14
  22. data/lib/json/ld/writer.rb +334 -311
  23. data/lib/json/ld.rb +103 -96
  24. metadata +78 -209
  25. data/spec/api_spec.rb +0 -132
  26. data/spec/compact_spec.rb +0 -3482
  27. data/spec/conneg_spec.rb +0 -373
  28. data/spec/context_spec.rb +0 -2036
  29. data/spec/expand_spec.rb +0 -4496
  30. data/spec/flatten_spec.rb +0 -1203
  31. data/spec/format_spec.rb +0 -115
  32. data/spec/frame_spec.rb +0 -2498
  33. data/spec/from_rdf_spec.rb +0 -1005
  34. data/spec/matchers.rb +0 -20
  35. data/spec/rdfstar_spec.rb +0 -25
  36. data/spec/reader_spec.rb +0 -883
  37. data/spec/resource_spec.rb +0 -76
  38. data/spec/spec_helper.rb +0 -281
  39. data/spec/streaming_reader_spec.rb +0 -237
  40. data/spec/streaming_writer_spec.rb +0 -145
  41. data/spec/suite_compact_spec.rb +0 -22
  42. data/spec/suite_expand_spec.rb +0 -36
  43. data/spec/suite_flatten_spec.rb +0 -34
  44. data/spec/suite_frame_spec.rb +0 -29
  45. data/spec/suite_from_rdf_spec.rb +0 -22
  46. data/spec/suite_helper.rb +0 -411
  47. data/spec/suite_html_spec.rb +0 -22
  48. data/spec/suite_http_spec.rb +0 -35
  49. data/spec/suite_remote_doc_spec.rb +0 -22
  50. data/spec/suite_to_rdf_spec.rb +0 -30
  51. data/spec/support/extensions.rb +0 -44
  52. data/spec/test-files/test-1-compacted.jsonld +0 -10
  53. data/spec/test-files/test-1-context.jsonld +0 -7
  54. data/spec/test-files/test-1-expanded.jsonld +0 -5
  55. data/spec/test-files/test-1-input.jsonld +0 -10
  56. data/spec/test-files/test-1-rdf.ttl +0 -8
  57. data/spec/test-files/test-2-compacted.jsonld +0 -20
  58. data/spec/test-files/test-2-context.jsonld +0 -7
  59. data/spec/test-files/test-2-expanded.jsonld +0 -16
  60. data/spec/test-files/test-2-input.jsonld +0 -20
  61. data/spec/test-files/test-2-rdf.ttl +0 -14
  62. data/spec/test-files/test-3-compacted.jsonld +0 -11
  63. data/spec/test-files/test-3-context.jsonld +0 -8
  64. data/spec/test-files/test-3-expanded.jsonld +0 -10
  65. data/spec/test-files/test-3-input.jsonld +0 -11
  66. data/spec/test-files/test-3-rdf.ttl +0 -8
  67. data/spec/test-files/test-4-compacted.jsonld +0 -10
  68. data/spec/test-files/test-4-context.jsonld +0 -7
  69. data/spec/test-files/test-4-expanded.jsonld +0 -6
  70. data/spec/test-files/test-4-input.jsonld +0 -10
  71. data/spec/test-files/test-4-rdf.ttl +0 -5
  72. data/spec/test-files/test-5-compacted.jsonld +0 -13
  73. data/spec/test-files/test-5-context.jsonld +0 -7
  74. data/spec/test-files/test-5-expanded.jsonld +0 -9
  75. data/spec/test-files/test-5-input.jsonld +0 -13
  76. data/spec/test-files/test-5-rdf.ttl +0 -7
  77. data/spec/test-files/test-6-compacted.jsonld +0 -10
  78. data/spec/test-files/test-6-context.jsonld +0 -7
  79. data/spec/test-files/test-6-expanded.jsonld +0 -10
  80. data/spec/test-files/test-6-input.jsonld +0 -10
  81. data/spec/test-files/test-6-rdf.ttl +0 -6
  82. data/spec/test-files/test-7-compacted.jsonld +0 -23
  83. data/spec/test-files/test-7-context.jsonld +0 -4
  84. data/spec/test-files/test-7-expanded.jsonld +0 -20
  85. data/spec/test-files/test-7-input.jsonld +0 -23
  86. data/spec/test-files/test-7-rdf.ttl +0 -14
  87. data/spec/test-files/test-8-compacted.jsonld +0 -34
  88. data/spec/test-files/test-8-context.jsonld +0 -11
  89. data/spec/test-files/test-8-expanded.jsonld +0 -24
  90. data/spec/test-files/test-8-frame.jsonld +0 -18
  91. data/spec/test-files/test-8-framed.jsonld +0 -25
  92. data/spec/test-files/test-8-input.jsonld +0 -30
  93. data/spec/test-files/test-8-rdf.ttl +0 -15
  94. data/spec/test-files/test-9-compacted.jsonld +0 -20
  95. data/spec/test-files/test-9-context.jsonld +0 -13
  96. data/spec/test-files/test-9-expanded.jsonld +0 -14
  97. data/spec/test-files/test-9-input.jsonld +0 -12
  98. data/spec/to_rdf_spec.rb +0 -1551
  99. data/spec/writer_spec.rb +0 -427
@@ -1,151 +1,153 @@
1
- module JSON::LD
2
- class API
3
- ##
4
- # Nokogiri implementation of an HTML parser.
5
- #
6
- # @see http://nokogiri.org/
7
- module Nokogiri
1
+ # frozen_string_literal: true
2
+
3
+ module JSON
4
+ module LD
5
+ class API
8
6
  ##
9
- # Returns the name of the underlying XML library.
7
+ # Nokogiri implementation of an HTML parser.
10
8
  #
11
- # @return [Symbol]
12
- def self.library
13
- :nokogiri
14
- end
15
-
16
- # Proxy class to implement uniform element accessors
17
- class NodeProxy
18
- attr_reader :node
19
- attr_reader :parent
20
-
21
- def initialize(node, parent = nil)
22
- @node = node
23
- @parent = parent
24
- end
25
-
9
+ # @see http://nokogiri.org/
10
+ module Nokogiri
26
11
  ##
27
- # Return xml:base on element, if defined
12
+ # Returns the name of the underlying XML library.
28
13
  #
29
- # @return [String]
30
- def base
31
- @node.attribute_with_ns("base", RDF::XML.to_s) || @node.attribute('xml:base')
14
+ # @return [Symbol]
15
+ def self.library
16
+ :nokogiri
32
17
  end
33
18
 
34
- def display_path
35
- @display_path ||= begin
36
- path = []
37
- path << parent.display_path if parent
38
- path << @node.name
39
- case @node
40
- when ::Nokogiri::XML::Element then path.join("/")
41
- when ::Nokogiri::XML::Attr then path.join("@")
42
- else path.join("?")
19
+ # Proxy class to implement uniform element accessors
20
+ class NodeProxy
21
+ attr_reader :node, :parent
22
+
23
+ def initialize(node, parent = nil)
24
+ @node = node
25
+ @parent = parent
26
+ end
27
+
28
+ ##
29
+ # Return xml:base on element, if defined
30
+ #
31
+ # @return [String]
32
+ def base
33
+ @node.attribute_with_ns("base", RDF::XML.to_s) || @node.attribute('xml:base')
34
+ end
35
+
36
+ def display_path
37
+ @display_path ||= begin
38
+ path = []
39
+ path << parent.display_path if parent
40
+ path << @node.name
41
+ case @node
42
+ when ::Nokogiri::XML::Element then path.join("/")
43
+ when ::Nokogiri::XML::Attr then path.join("@")
44
+ else path.join("?")
45
+ end
43
46
  end
44
47
  end
45
- end
46
48
 
47
- ##
48
- # Return true of all child elements are text
49
- #
50
- # @return [Array<:text, :element, :attribute>]
51
- def text_content?
52
- @node.children.all? {|c| c.text?}
53
- end
49
+ ##
50
+ # Return true of all child elements are text
51
+ #
52
+ # @return [Array<:text, :element, :attribute>]
53
+ def text_content?
54
+ @node.children.all?(&:text?)
55
+ end
54
56
 
55
- ##
56
- # Children of this node
57
- #
58
- # @return [NodeSetProxy]
59
- def children
60
- NodeSetProxy.new(@node.children, self)
61
- end
57
+ ##
58
+ # Children of this node
59
+ #
60
+ # @return [NodeSetProxy]
61
+ def children
62
+ NodeSetProxy.new(@node.children, self)
63
+ end
62
64
 
63
- # Ancestors of this element, in order
64
- def ancestors
65
- @ancestors ||= parent ? parent.ancestors + [parent] : []
66
- end
65
+ # Ancestors of this element, in order
66
+ def ancestors
67
+ @ancestors ||= parent ? parent.ancestors + [parent] : []
68
+ end
67
69
 
68
- ##
69
- # Inner text of an element. Decode Entities
70
- #
71
- # @return [String]
72
- #def inner_text
73
- # coder = HTMLEntities.new
74
- # coder.decode(@node.inner_text)
75
- #end
76
-
77
- def attribute_nodes
78
- @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)
79
- end
70
+ ##
71
+ # Inner text of an element. Decode Entities
72
+ #
73
+ # @return [String]
74
+ # def inner_text
75
+ # coder = HTMLEntities.new
76
+ # coder.decode(@node.inner_text)
77
+ # end
78
+
79
+ def attribute_nodes
80
+ @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)
81
+ end
80
82
 
81
- def xpath(*args)
82
- @node.xpath(*args).map do |n|
83
- # Get node ancestors
84
- parent = n.ancestors.reverse.inject(nil) do |p,node|
85
- NodeProxy.new(node, p)
83
+ def xpath(*args)
84
+ @node.xpath(*args).map do |n|
85
+ # Get node ancestors
86
+ parent = n.ancestors.reverse.inject(nil) do |p, node|
87
+ NodeProxy.new(node, p)
88
+ end
89
+ NodeProxy.new(n, parent)
86
90
  end
87
- NodeProxy.new(n, parent)
91
+ end
92
+
93
+ ##
94
+ # Proxy for everything else to @node
95
+ def method_missing(method, *args)
96
+ @node.send(method, *args)
88
97
  end
89
98
  end
90
99
 
91
100
  ##
92
- # Proxy for everything else to @node
93
- def method_missing(method, *args)
94
- @node.send(method, *args)
95
- end
96
- end
101
+ # NodeSet proxy
102
+ class NodeSetProxy
103
+ attr_reader :node_set, :parent
97
104
 
98
- ##
99
- # NodeSet proxy
100
- class NodeSetProxy
101
- attr_reader :node_set
102
- attr_reader :parent
103
-
104
- def initialize(node_set, parent)
105
- @node_set = node_set
106
- @parent = parent
107
- end
105
+ def initialize(node_set, parent)
106
+ @node_set = node_set
107
+ @parent = parent
108
+ end
108
109
 
109
- ##
110
- # Return a proxy for each child
111
- #
112
- # @yield child
113
- # @yieldparam [NodeProxy]
114
- def each
115
- @node_set.each do |c|
116
- yield NodeProxy.new(c, parent)
110
+ ##
111
+ # Return a proxy for each child
112
+ #
113
+ # @yield child
114
+ # @yieldparam [NodeProxy]
115
+ def each
116
+ @node_set.each do |c|
117
+ yield NodeProxy.new(c, parent)
118
+ end
117
119
  end
118
- end
119
120
 
120
- ##
121
- # Proxy for everything else to @node_set
122
- def method_missing(method, *args)
123
- @node_set.send(method, *args)
121
+ ##
122
+ # Proxy for everything else to @node_set
123
+ def method_missing(method, *args)
124
+ @node_set.send(method, *args)
125
+ end
124
126
  end
125
- end
126
127
 
127
- ##
128
- # Initializes the underlying XML library.
129
- #
130
- # @param [Hash{Symbol => Object}] options
131
- # @return [NodeProxy] of root element
132
- def initialize_html_nokogiri(input, options = {})
133
- require 'nokogiri' unless defined?(::Nokogiri)
134
- doc = case input
135
- when ::Nokogiri::HTML::Document, ::Nokogiri::XML::Document
136
- input
137
- else
138
- begin
139
- input = input.read if input.respond_to?(:read)
140
- ::Nokogiri::HTML5(input.force_encoding('utf-8'), max_parse_errors: 1000)
141
- rescue LoadError, NoMethodError
142
- ::Nokogiri::HTML.parse(input, base_uri.to_s, 'utf-8')
128
+ ##
129
+ # Initializes the underlying XML library.
130
+ #
131
+ # @param [Hash{Symbol => Object}] options
132
+ # @return [NodeProxy] of root element
133
+ def initialize_html_nokogiri(input, _options = {})
134
+ require 'nokogiri' unless defined?(::Nokogiri)
135
+ doc = case input
136
+ when ::Nokogiri::HTML::Document, ::Nokogiri::XML::Document
137
+ input
138
+ else
139
+ begin
140
+ input = input.read if input.respond_to?(:read)
141
+ ::Nokogiri::HTML5(input.force_encoding('utf-8'), max_parse_errors: 1000)
142
+ rescue LoadError, NoMethodError
143
+ ::Nokogiri::HTML.parse(input, base_uri.to_s, 'utf-8')
144
+ end
143
145
  end
144
- end
145
146
 
146
- NodeProxy.new(doc.root) if doc && doc.root
147
+ NodeProxy.new(doc.root) if doc&.root
148
+ end
149
+ alias initialize_html initialize_html_nokogiri
147
150
  end
148
- alias_method :initialize_html, :initialize_html_nokogiri
149
151
  end
150
152
  end
151
153
  end
@@ -1,187 +1,191 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'htmlentities'
2
4
 
3
- module JSON::LD
4
- class API
5
- ##
6
- # REXML implementation of an XML parser.
7
- #
8
- # @see http://www.germane-software.com/software/rexml/
9
- module REXML
5
+ module JSON
6
+ module LD
7
+ class API
10
8
  ##
11
- # Returns the name of the underlying XML library.
9
+ # REXML implementation of an XML parser.
12
10
  #
13
- # @return [Symbol]
14
- def self.library
15
- :rexml
16
- end
17
-
18
- # Proxy class to implement uniform element accessors
19
- class NodeProxy
20
- attr_reader :node
21
- attr_reader :parent
22
-
23
- def initialize(node, parent = nil)
24
- @node = node
25
- @parent = parent
26
- end
27
-
11
+ # @see http://www.germane-software.com/software/rexml/
12
+ module REXML
28
13
  ##
29
- # Return xml:base on element, if defined
14
+ # Returns the name of the underlying XML library.
30
15
  #
31
- # @return [String]
32
- def base
33
- @node.attribute("base", RDF::XML.to_s) || @node.attribute('xml:base')
16
+ # @return [Symbol]
17
+ def self.library
18
+ :rexml
34
19
  end
35
20
 
36
- def display_path
37
- @display_path ||= begin
38
- path = []
39
- path << parent.display_path if parent
40
- path << @node.name
41
- case @node
42
- when ::REXML::Element then path.join("/")
43
- when ::REXML::Attribute then path.join("@")
44
- else path.join("?")
21
+ # Proxy class to implement uniform element accessors
22
+ class NodeProxy
23
+ attr_reader :node, :parent
24
+
25
+ def initialize(node, parent = nil)
26
+ @node = node
27
+ @parent = parent
28
+ end
29
+
30
+ ##
31
+ # Return xml:base on element, if defined
32
+ #
33
+ # @return [String]
34
+ def base
35
+ @node.attribute("base", RDF::XML.to_s) || @node.attribute('xml:base')
36
+ end
37
+
38
+ def display_path
39
+ @display_path ||= begin
40
+ path = []
41
+ path << parent.display_path if parent
42
+ path << @node.name
43
+ case @node
44
+ when ::REXML::Element then path.join("/")
45
+ when ::REXML::Attribute then path.join("@")
46
+ else path.join("?")
47
+ end
45
48
  end
46
49
  end
47
- end
48
50
 
49
- ##
50
- # Return true of all child elements are text
51
- #
52
- # @return [Array<:text, :element, :attribute>]
53
- def text_content?
54
- @node.children.all? {|c| c.is_a?(::REXML::Text)}
55
- end
51
+ ##
52
+ # Return true of all child elements are text
53
+ #
54
+ # @return [Array<:text, :element, :attribute>]
55
+ def text_content?
56
+ @node.children.all?(::REXML::Text)
57
+ end
56
58
 
57
- ##
58
- # Children of this node
59
- #
60
- # @return [NodeSetProxy]
61
- def children
62
- NodeSetProxy.new(@node.children, self)
63
- end
59
+ ##
60
+ # Children of this node
61
+ #
62
+ # @return [NodeSetProxy]
63
+ def children
64
+ NodeSetProxy.new(@node.children, self)
65
+ end
64
66
 
65
- # Ancestors of this element, in order
66
- def ancestors
67
- @ancestors ||= parent ? parent.ancestors + [parent] : []
68
- end
67
+ # Ancestors of this element, in order
68
+ def ancestors
69
+ @ancestors ||= parent ? parent.ancestors + [parent] : []
70
+ end
69
71
 
70
- ##
71
- # Inner text of an element
72
- #
73
- # @see http://apidock.com/ruby/REXML/Element/get_text#743-Get-all-inner-texts
74
- # @return [String]
75
- def inner_text
76
- coder = HTMLEntities.new
77
- ::REXML::XPath.match(@node,'.//text()').map { |e|
78
- coder.decode(e)
79
- }.join
80
- end
72
+ ##
73
+ # Inner text of an element
74
+ #
75
+ # @see http://apidock.com/ruby/REXML/Element/get_text#743-Get-all-inner-texts
76
+ # @return [String]
77
+ def inner_text
78
+ coder = HTMLEntities.new
79
+ ::REXML::XPath.match(@node, './/text()').map do |e|
80
+ coder.decode(e)
81
+ end.join
82
+ end
81
83
 
82
- ##
83
- # Inner text of an element
84
- #
85
- # @see http://apidock.com/ruby/REXML/Element/get_text#743-Get-all-inner-texts
86
- # @return [String]
87
- def inner_html
88
- @node.children.map(&:to_s).join
89
- end
84
+ ##
85
+ # Inner text of an element
86
+ #
87
+ # @see http://apidock.com/ruby/REXML/Element/get_text#743-Get-all-inner-texts
88
+ # @return [String]
89
+ def inner_html
90
+ @node.children.map(&:to_s).join
91
+ end
90
92
 
91
- def attribute_nodes
92
- attrs = @node.attributes.dup.keep_if do |name, attr|
93
- !name.start_with?('xmlns')
93
+ def attribute_nodes
94
+ attrs = @node.attributes.dup.keep_if do |name, _attr|
95
+ !name.start_with?('xmlns')
96
+ end
97
+ @attribute_nodes ||= (attrs.empty? ? attrs : NodeSetProxy.new(attrs, self))
94
98
  end
95
- @attribute_nodes ||= (attrs.empty? ? attrs : NodeSetProxy.new(attrs, self))
96
- end
97
99
 
98
- ##
99
- # Node type accessors
100
- #
101
- # @return [Boolean]
102
- def text?
103
- @node.is_a?(::REXML::Text)
104
- end
100
+ ##
101
+ # Node type accessors
102
+ #
103
+ # @return [Boolean]
104
+ def text?
105
+ @node.is_a?(::REXML::Text)
106
+ end
105
107
 
106
- def element?
107
- @node.is_a?(::REXML::Element)
108
- end
108
+ def element?
109
+ @node.is_a?(::REXML::Element)
110
+ end
109
111
 
110
- def blank?
111
- @node.is_a?(::REXML::Text) && @node.empty?
112
- end
112
+ def blank?
113
+ @node.is_a?(::REXML::Text) && @node.empty?
114
+ end
113
115
 
114
- def to_s; @node.to_s; end
116
+ def to_s
117
+ @node.to_s
118
+ end
115
119
 
116
- def xpath(*args)
117
- ::REXML::XPath.match(@node, *args).map do |n|
118
- NodeProxy.new(n, parent)
120
+ def xpath(*args)
121
+ ::REXML::XPath.match(@node, *args).map do |n|
122
+ NodeProxy.new(n, parent)
123
+ end
124
+ end
125
+
126
+ def at_xpath(*args)
127
+ xpath(*args).first
119
128
  end
120
- end
121
129
 
122
- def at_xpath(*args)
123
- xpath(*args).first
130
+ ##
131
+ # Proxy for everything else to @node
132
+ def method_missing(method, *args)
133
+ @node.send(method, *args)
134
+ end
124
135
  end
125
136
 
126
137
  ##
127
- # Proxy for everything else to @node
128
- def method_missing(method, *args)
129
- @node.send(method, *args)
130
- end
131
- end
138
+ # NodeSet proxy
139
+ class NodeSetProxy
140
+ attr_reader :node_set, :parent
132
141
 
133
- ##
134
- # NodeSet proxy
135
- class NodeSetProxy
136
- attr_reader :node_set
137
- attr_reader :parent
138
-
139
- def initialize(node_set, parent)
140
- @node_set = node_set
141
- @parent = parent
142
- end
142
+ def initialize(node_set, parent)
143
+ @node_set = node_set
144
+ @parent = parent
145
+ end
143
146
 
144
- ##
145
- # Return a proxy for each child
146
- #
147
- # @yield child
148
- # @yieldparam [NodeProxy]
149
- def each
150
- @node_set.each do |c|
151
- yield NodeProxy.new(c, parent)
147
+ ##
148
+ # Return a proxy for each child
149
+ #
150
+ # @yield child
151
+ # @yieldparam [NodeProxy]
152
+ def each
153
+ @node_set.each do |c|
154
+ yield NodeProxy.new(c, parent)
155
+ end
152
156
  end
153
- end
154
157
 
155
- ##
156
- def to_html
157
- node_set.map(&:to_s).join("")
158
+ ##
159
+ def to_html
160
+ node_set.map(&:to_s).join
161
+ end
162
+
163
+ ##
164
+ # Proxy for everything else to @node_set
165
+ def method_missing(method, *args)
166
+ @node_set.send(method, *args)
167
+ end
158
168
  end
159
169
 
160
170
  ##
161
- # Proxy for everything else to @node_set
162
- def method_missing(method, *args)
163
- @node_set.send(method, *args)
164
- end
165
- end
171
+ # Initializes the underlying XML library.
172
+ #
173
+ # @param [Hash{Symbol => Object}] options
174
+ # @return [NodeProxy] of document root
175
+ def initialize_html_rexml(input, _options = {})
176
+ require 'rexml/document' unless defined?(::REXML)
177
+ doc = case input
178
+ when ::REXML::Document
179
+ input
180
+ else
181
+ # Only parse as XML, no HTML mode
182
+ ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s)
183
+ end
166
184
 
167
- ##
168
- # Initializes the underlying XML library.
169
- #
170
- # @param [Hash{Symbol => Object}] options
171
- # @return [NodeProxy] of document root
172
- def initialize_html_rexml(input, options = {})
173
- require 'rexml/document' unless defined?(::REXML)
174
- doc = case input
175
- when ::REXML::Document
176
- input
177
- else
178
- # Only parse as XML, no HTML mode
179
- ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s)
185
+ NodeProxy.new(doc.root) if doc&.root
180
186
  end
181
-
182
- NodeProxy.new(doc.root) if doc && doc.root
187
+ alias initialize_html initialize_html_rexml
183
188
  end
184
- alias_method :initialize_html, :initialize_html_rexml
185
189
  end
186
190
  end
187
191
  end