class AttrPassword::Adapters::Ruby

The ActiveRecord adapter

Public Instance Methods

read_attribute(attribute) click to toggle source

Read an attribute

Example:

>> adapter.read_attribute(:hello_world)
=> "Hello, World!"
# File lib/attr_password/adapters/ruby.rb, line 12
def read_attribute(attribute)
  @object.instance_variable_get("@#{attribute}")
end
write_attribute(attribute, value) click to toggle source

Write an attribute

Example:

>> adapter.write_attribute(:hello_world, "Hello, World!")
=> true
# File lib/attr_password/adapters/ruby.rb, line 22
def write_attribute(attribute, value)
  @object.instance_variable_set("@#{attribute}", value)
end