Class: TokenMaster::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/token_master/config.rb

Constant Summary collapse

DEFAULT_VALUES =
{
  token_lifetime: 14,
  required_params: [],
  token_length: 20
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



11
12
13
# File 'lib/token_master/config.rb', line 11

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/token_master/config.rb', line 9

def options
  @options
end

Instance Method Details

#add_tokenable_options(key, **params) ⇒ Object



15
16
17
# File 'lib/token_master/config.rb', line 15

def add_tokenable_options(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

Returns:

  • (Boolean)


31
32
33
# File 'lib/token_master/config.rb', line 31

def options_set?(key)
  @options.key? key
end