Attributes

Attributes provides a set of class methods for defining an attributes schema and instance methods for reading and writing attributes.

Originally part of ActiveAttr, https://github.com/cgriego/active_attr

Constants

  • DEPRECATED_OBJECT_METHODS

Methods

#==

Performs equality checking on the result of attributes and its type.

def ==(other)
  return false unless other.instance_of? self.class
  attributes == other.attributes
end
#[]=

Write a single attribute to the model’s attribute hash.

def write_attribute(name, value)
  if respond_to? "#{name}="
    send "#{name}=", value
  else
    fail Neo4j::UnknownAttributeError, "unknown attribute: #{name}"
  end
end
#attributes

Returns a Hash of all attributes

def attributes
  attributes_map { |name| send name }
end
#write_attribute

Write a single attribute to the model’s attribute hash.

def write_attribute(name, value)
  if respond_to? "#{name}="
    send "#{name}=", value
  else
    fail Neo4j::UnknownAttributeError, "unknown attribute: #{name}"
  end
end