Class: TokenMaster::Config
- Inherits:
-
Object
- Object
- TokenMaster::Config
- Defined in:
- lib/token_master/config.rb
Constant Summary collapse
- DEFAULT_VALUES =
{ token_lifetime: 14, required_params: [], token_length: 20 }
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #add_tokenable_options(key, **params) ⇒ Object
- #get_required_params(key) ⇒ Object
- #get_token_length(key) ⇒ Object
- #get_token_lifetime(key) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #options_set?(key) ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 |
# File 'lib/token_master/config.rb', line 11 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/token_master/config.rb', line 9 def @options end |
Instance Method Details
#add_tokenable_options(key, **params) ⇒ Object
15 16 17 |
# File 'lib/token_master/config.rb', line 15 def (key, **params) @options[key] = params end |
#get_required_params(key) ⇒ Object
19 20 21 |
# File 'lib/token_master/config.rb', line 19 def get_required_params(key) get_option(key, :required_params) end |
#get_token_length(key) ⇒ Object
27 28 29 |
# File 'lib/token_master/config.rb', line 27 def get_token_length(key) get_option(key, :token_length) end |
#get_token_lifetime(key) ⇒ Object
23 24 25 |
# File 'lib/token_master/config.rb', line 23 def get_token_lifetime(key) get_option(key, :token_lifetime) end |
#options_set?(key) ⇒ Boolean
31 32 33 |
# File 'lib/token_master/config.rb', line 31 def (key) @options.key? key end |