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.
23 24 25 |
# File 'lib/auther/keymaster.rb', line 23 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
18 19 20 21 |
# File 'lib/auther/keymaster.rb', line 18 def self.get_account_login session = {} account_name = get_account_name session session[new(account_name).login_key] end |
.get_account_name(session = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/auther/keymaster.rb', line 12 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 |
# File 'lib/auther/keymaster.rb', line 8 def self.namespace = "auther" |
.redirect_url_key(delimiter: "_") ⇒ Object
10 |
# File 'lib/auther/keymaster.rb', line 10 def self.redirect_url_key(delimiter: "_") = [namespace, "redirect", "url"] * delimiter |
Instance Method Details
#login_key ⇒ Object
27 |
# File 'lib/auther/keymaster.rb', line 27 def login_key = build_key "login" |
#password_key ⇒ Object
29 |
# File 'lib/auther/keymaster.rb', line 29 def password_key = build_key "password" |