module Cylons::Attributes
Public Instance Methods
read_attribute(name)
click to toggle source
# File lib/cylons/attributes.rb, line 3 def read_attribute(name) name = name.to_s if @attributes.has_key?(name) || self.respond_to?(name) @attributes[name] else raise ::ActiveAttr::UnknownAttributeError, "unknown attribute: #{name}" end end
Also aliased as: []
write_attribute(name, value)
click to toggle source
Override write_attribute
(along with []=
) so we can provide support for ActiveModel::Dirty.
# File lib/cylons/attributes.rb, line 17 def write_attribute(name, value) __send__("#{name}_will_change!") if value != self[name] name = name.to_s if @attributes.has_key?(name) || self.respond_to?(name) @attributes[name] = value else raise ::ActiveAttr::UnknownAttributeError, "unknown attribute: #{name}" end end
Also aliased as: []=, attribute=