The smarts of converting from XML and JSON into internal objects
The actual Schema class
# File lib/cimi/model/schema.rb, line 206 def initialize @attributes = [] end
# File lib/cimi/model/schema.rb, line 272 def add_attributes!(args, attr_klass, &block) raise "The schema has already been used to convert objects" if @attributes.frozen? opts = args.extract_opts! args.each { |arg| @attributes << attr_klass.new(arg, opts, &block) } end
# File lib/cimi/model/schema.rb, line 234 def attribute_names @attributes.map { |a| a.name } end
# File lib/cimi/model/schema.rb, line 216 def from_json(json, model = {}) @attributes.freeze @attributes.each { |attr| attr.from_json(json, model) } model end
# File lib/cimi/model/schema.rb, line 210 def from_xml(xml, model = {}) @attributes.freeze @attributes.each { |attr| attr.from_xml(xml, model) } model end
Generated with the Darkfish Rdoc Generator 2.