# File lib/sax-machine/sax_document.rb, line 37 def column(sym) columns.select{|c| c.column == sym}[0] end
# File lib/sax-machine/sax_document.rb, line 49 def column_names columns.map{|e| e.column} end
# File lib/sax-machine/sax_document.rb, line 33 def columns sax_config.columns end
# File lib/sax-machine/sax_document.rb, line 41 def data_class(sym) column(sym).data_class end
# File lib/sax-machine/sax_document.rb, line 22 def element(name, options = {}) options[:as] ||= name sax_config.add_top_level_element(name, options) # we only want to insert the getter and setter if they haven't defined it from elsewhere. # 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
# File lib/sax-machine/sax_document.rb, line 53 def elements(name, options = {}) options[:as] ||= name if options[:class] sax_config.add_collection_element(name, options) else class_eval def add_#{options[:as]}(value) #{options[:as]} << value end sax_config.add_top_level_element(name, options.merge(:collection => true)) end if !instance_methods.include?(options[:as].to_s) class_eval def #{options[:as]} @#{options[:as]} ||= [] end end attr_writer options[:as] unless instance_methods.include?("#{options[:as]}=") end
# File lib/sax-machine/sax_document.rb, line 18 def parse(xml_text) new.parse(xml_text) end
Generated with the Darkfish Rdoc Generator 2.