Class: Auther::Keymaster
- Inherits:
-
Object
- Object
- Auther::Keymaster
- Defined in:
- lib/auther/keymaster.rb
Overview
Provides access to setting keys.
Instance Attribute Summary collapse
-
#account_name ⇒ Object
readonly
Returns the value of attribute account_name.
Class Method Summary collapse
- .get_account_login(session = {}) ⇒ Object
- .get_account_name(session = {}) ⇒ Object
- .namespace ⇒ Object
- .redirect_url_key(delimiter: "_") ⇒ Object
Instance Method Summary collapse
-
#initialize(account_name = nil) ⇒ Keymaster
constructor
A new instance of Keymaster.
- #login_key ⇒ Object
- #password_key ⇒ Object
Constructor Details
#initialize(account_name = nil) ⇒ Keymaster
Returns a new instance of Keymaster.
27 28 29 |
# File 'lib/auther/keymaster.rb', line 27 def initialize account_name = nil @account_name = account_name end |
Instance Attribute Details
#account_name ⇒ Object (readonly)
Returns the value of attribute account_name.
6 7 8 |
# File 'lib/auther/keymaster.rb', line 6 def account_name @account_name end |
Class Method Details
.get_account_login(session = {}) ⇒ Object
22 23 24 25 |
# File 'lib/auther/keymaster.rb', line 22 def self.get_account_login session = {} account_name = get_account_name session session[new(account_name).login_key] end |
.get_account_name(session = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/auther/keymaster.rb', line 16 def self.get_account_name session = {} matching_keys = session.keys.select { |key| key.to_s =~ /auther.+login/ } key = matching_keys.first || "" key.gsub("#{namespace}_", "").gsub "_login", "" end |
.namespace ⇒ Object
8 9 10 |
# File 'lib/auther/keymaster.rb', line 8 def self.namespace "auther" end |
.redirect_url_key(delimiter: "_") ⇒ Object
12 13 14 |
# File 'lib/auther/keymaster.rb', line 12 def self.redirect_url_key delimiter: "_" [namespace, "redirect", "url"] * delimiter end |
Instance Method Details
#login_key ⇒ Object
31 32 33 |
# File 'lib/auther/keymaster.rb', line 31 def login_key build_key "login" end |
#password_key ⇒ Object
35 36 37 |
# File 'lib/auther/keymaster.rb', line 35 def password_key build_key "password" end |