Module: PasswordAttribute

Defined in:
lib/sixarm_ruby_password_attribute.rb

Instance Method Summary collapse

Instance Method Details

#passwordObject

Read the :password attribute as a new BCrypt::Password. Return the BCrypt::Password.



13
14
15
# File 'lib/sixarm_ruby_password_attribute.rb', line 13

def password
  BCrypt::Password.new(password_before_type_cast)
end

#password=(plain_text) ⇒ Object

Write the :password attribute as a new BCrypt::Password.



19
20
21
# File 'lib/sixarm_ruby_password_attribute.rb', line 19

def password=(plain_text)
  write_attribute(:password,BCrypt::Password.create(plain_text))
end