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

# => ["name", "age"]
person.attribute_names
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

# => {"name"=>"Francesco", "age"=>22}
person.attributes
person = Person.new(name: 'Francesco', age: 22)

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

include ActiveModel::Attributes
class Person

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

def freeze

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

def initialize(*)

def initialize(*)
  @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