Class: AuthorizeRbac::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/authorize_rbac/configuration.rb

Defined Under Namespace

Classes: InvalidKey

Constant Summary collapse

CONFIG_KEYS =
[
 :current_user_method,
 :default_controller,
 :default_action
]

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
# File 'lib/authorize_rbac/configuration.rb', line 10

def initialize
  @configs = {}
end

Instance Method Details

#[](key) ⇒ Object



20
21
22
# File 'lib/authorize_rbac/configuration.rb', line 20

def [](key)
  @configs[key]
end

#[]=(key, value) ⇒ Object

Raises:



14
15
16
17
18
# File 'lib/authorize_rbac/configuration.rb', line 14

def []=(key, value)
  raise InvalidKey, key unless CONFIG_KEYS.include?(key)

  @configs[key] = value
end