lib/sax-machine/sax_config.rb in UnderpantsGnome-sax-machine-0.0.13 vs lib/sax-machine/sax_config.rb in UnderpantsGnome-sax-machine-0.0.14

- old
+ new

@@ -3,21 +3,30 @@ module SAXMachine class SAXConfig def initialize @top_level_elements = [] + @complex_elements = [] @collection_elements = [] end def add_top_level_element(name, options) @top_level_elements << ElementConfig.new(name, options) end + def add_complex_element(name, options) + @complex_elements << ElementConfig.new(name, options) + end + def add_collection_element(name, options) @collection_elements << CollectionConfig.new(name, options) end + def complex_config(name) + @complex_elements.detect { |ce| ce.name.to_s == name.to_s } + end + def collection_config(name) @collection_elements.detect { |ce| ce.name.to_s == name.to_s } end def element_configs_for_attribute(name, attrs) @@ -31,8 +40,7 @@ @top_level_elements.detect do |element_config| element_config.name == name && element_config.attrs_match?(attrs) end end - end -end \ No newline at end of file +end