Sha256: 4fcc7e6a8ed3700f6ef3a7c7c7b7c267394ec654d44ce5579ba06ef8d18f85f4
Contents?: true
Size: 937 Bytes
Versions: 11
Compression:
Stored size: 937 Bytes
Contents
# frozen_string_literal: true module Auther # Provides access to setting keys. class Keymaster attr_reader :account_name def self.namespace = "auther" def self.redirect_url_key(delimiter: "_") = [namespace, "redirect", "url"] * delimiter 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 def self.get_account_login session = {} account_name = get_account_name session session[new(account_name).login_key] end def initialize account_name = nil @account_name = account_name end def login_key = build_key "login" def password_key = build_key "password" private def build_key key_name, delimiter: "_" [self.class.namespace, account_name, key_name].compact * delimiter end end end
Version data entries
11 entries across 11 versions & 1 rubygems