module XmlResource::Model
Constants
- TRUE_VALUES
Public Class Methods
included(base)
click to toggle source
# File lib/xml_resource/model.rb, line 5 def self.included(base) base.extend ClassMethods base.class_eval do class_attribute :attributes, :collections, :objects, :root_path, :remove_namespaces, :inflection self.attributes = {} self.collections = {} self.objects = {} self.inflection = :underscore end end
new(attrs = {})
click to toggle source
Calls superclass method
# File lib/xml_resource/model.rb, line 179 def initialize(attrs = {}) self.attributes = attrs if attrs super() end
Public Instance Methods
[](attr_name)
click to toggle source
# File lib/xml_resource/model.rb, line 198 def [](attr_name) attributes[attr_name] end
[]=(attr_name, value)
click to toggle source
# File lib/xml_resource/model.rb, line 202 def []=(attr_name, value) attributes[attr_name] = value end
attributes()
click to toggle source
# File lib/xml_resource/model.rb, line 194 def attributes @attributes ||= {}.with_indifferent_access end
attributes=(attrs)
click to toggle source
# File lib/xml_resource/model.rb, line 188 def attributes=(attrs) attrs.each do |attr, value| self.public_send("#{attr}=", value) end end
valid?()
click to toggle source
# File lib/xml_resource/model.rb, line 184 def valid? true end