pauldix-sax-machine 0.0.11 → 0.0.12
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.
- data/lib/sax-machine/sax_handler.rb +3 -1
- data/lib/sax-machine.rb +1 -1
- data/spec/sax-machine/sax_document_spec.rb +9 -0
- metadata +1 -1
@@ -77,7 +77,9 @@ module SAXMachine
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def mark_as_parsed
|
80
|
-
|
80
|
+
# TODO: make this code not suck like this
|
81
|
+
@parsed_configs[@element_config] = true unless (@element_config.respond_to?(:collection?) && @element_config.collection?) ||
|
82
|
+
(@element_config.class == Array && @element_config.first.collection?)
|
81
83
|
end
|
82
84
|
|
83
85
|
def parsed_config?
|
data/lib/sax-machine.rb
CHANGED
@@ -248,6 +248,15 @@ describe "SAXMachine" do
|
|
248
248
|
document = @klass.parse("<xml><entry>hello</entry><entry>world</entry></xml>")
|
249
249
|
document.entries.should == ["hello", "world"]
|
250
250
|
end
|
251
|
+
|
252
|
+
it "should parse multiple elements when taking an attribute value" do
|
253
|
+
attribute_klass = Class.new do
|
254
|
+
include SAXMachine
|
255
|
+
elements :entry, :as => :entries, :value => :foo
|
256
|
+
end
|
257
|
+
doc = attribute_klass.parse("<xml><entry foo='asdf' /><entry foo='jkl' /></xml>")
|
258
|
+
doc.entries.should == ["asdf", "jkl"]
|
259
|
+
end
|
251
260
|
end
|
252
261
|
|
253
262
|
describe "when using the class option" do
|