For an array :things, we collect all <thing/> elements (XmlSimple actually does the collecting)
# File lib/cimi/model/schema.rb, line 149 def initialize(name, opts = {}, &block) opts[:xml_name] = name.to_s.singularize unless opts[:xml_name] super(name, opts) @struct = Struct.new(name, opts, &block) end
# File lib/cimi/model/schema.rb, line 159 def from_json(json, model) model[name] = (json[json_name] || []).map { |elt| @struct.convert_from_json(elt) } end
# File lib/cimi/model/schema.rb, line 155 def from_xml(xml, model) model[name] = (xml[xml_name] || []).map { |elt| @struct.convert_from_xml(elt) } end
Generated with the Darkfish Rdoc Generator 2.