Class: Hector::Identity
- Inherits:
-
Object
- Object
- Hector::Identity
- Defined in:
- lib/hector/identity.rb
Class Attribute Summary collapse
-
.adapter ⇒ Object
Returns the value of attribute adapter.
Instance Attribute Summary collapse
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #==(identity) ⇒ Object
-
#initialize(username) ⇒ Identity
constructor
A new instance of Identity.
Constructor Details
#initialize(username) ⇒ Identity
Returns a new instance of Identity.
15 16 17 |
# File 'lib/hector/identity.rb', line 15 def initialize(username) @username = username end |
Class Attribute Details
.adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/hector/identity.rb', line 6 def adapter @adapter end |
Instance Attribute Details
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/hector/identity.rb', line 3 def username @username end |
Class Method Details
.authenticate(username, password) ⇒ Object
8 9 10 11 12 |
# File 'lib/hector/identity.rb', line 8 def authenticate(username, password) adapter.authenticate(username, password) do |authenticated| yield authenticated ? new(username) : nil end end |