pauldix-sax-machine 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,9 @@ module SAXMachine
77
77
  end
78
78
 
79
79
  def mark_as_parsed
80
- @parsed_configs[@element_config] = true unless (@element_config.respond_to?(:collection?) && @element_config.collection?)
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
@@ -7,5 +7,5 @@ require "sax-machine/sax_handler"
7
7
  require "sax-machine/sax_config"
8
8
 
9
9
  module SAXMachine
10
- VERSION = "0.0.11"
10
+ VERSION = "0.0.12"
11
11
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pauldix-sax-machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix