lib/sax-machine/sax_document.rb in astro-sax-machine-0.0.12.20090419 vs lib/sax-machine/sax_document.rb in astro-sax-machine-0.0.14

- old
+ new

@@ -39,9 +39,29 @@ # this is how we allow custom parsing behavior. So you could define the setter # and have it parse the string into a date or whatever. attr_reader options[:as] unless instance_methods.include?(options[:as].to_s) attr_writer options[:as] unless instance_methods.include?("#{options[:as]}=") end + + def columns + sax_config.top_level_elements + end + + def column(sym) + columns.select{|c| c.column == sym}[0] + end + + def data_class(sym) + column(sym).data_class + end + + def required?(sym) + column(sym).required? + end + + def column_names + columns.map{|e| e.column} + end def elements(name, options = {}) options[:as] ||= name if options[:class] sax_config.add_collection_element(name, options)