module ActiveModel::Attributes

def _write_attribute(attr_name, value)

def _write_attribute(attr_name, value)
  @attributes.write_from_user(attr_name, value)
end

def attribute(attr_name)

def attribute(attr_name)
  @attributes.fetch_value(attr_name)
end

def attribute_names

person.attribute_names # => ["name", "age"]
person = Person.new

end
attribute :age, :integer
attribute :name, :string

include ActiveModel::Attributes
class Person

Returns an array of attribute names as strings.
def attribute_names
  @attributes.keys
end

def attributes

person.attributes # => { "name" => "Francesco", "age" => 22}

person.age = 22
person.name = "Francesco"
person = Person.new

end
attribute :age, :integer
attribute :name, :string

include ActiveModel::Attributes
class Person

values of the attributes as values.
Returns a hash of all the attributes with their names as keys and the
def attributes
  @attributes.to_hash
end

def freeze # :nodoc:

:nodoc:
def freeze # :nodoc:
  @attributes = @attributes.clone.freeze unless frozen?
  super
end

def initialize(*) # :nodoc:

:nodoc:
def initialize(*) # :nodoc:
  @attributes = self.class._default_attributes.deep_dup
  super
end

def initialize_dup(other) # :nodoc:

:nodoc:
def initialize_dup(other) # :nodoc:
  @attributes = @attributes.deep_dup
  super
end