class AttrPassword::Adapters::Base

The base adapter

Attributes

object[R]

The object the adapter relates to

Public Class Methods

new(object) click to toggle source

Create a new instance of this adapter

Example:

>> AttrPassword::Adapters::Base.new(object)
=> #<AttrPassword::Adapters::Base:0x00000000000000>
# File lib/attr_password/adapters/base.rb, line 16
def initialize(object)
  # Ensure the object exists
  unless object
    raise 'The object property cannot be nil.'
  end

  # Store the object
  @object = object
end

Public Instance Methods

available?() click to toggle source

Check if this adapter can be used for the object

Example:

>> adapter.available?
=> true
# File lib/attr_password/adapters/base.rb, line 32
def available?
  true
end
read_attribute(attribute, value) click to toggle source

Read an attribute

Example:

>> adapter.read_attribute(:hello_world)
=> "Hello, World!"
# File lib/attr_password/adapters/base.rb, line 42
def read_attribute(attribute, value)
  nil
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/base.rb, line 52
def write_attribute(attribute, value)
  false
end