Class: Kan::AbilitiesList

Inherits:
Object
  • Object
show all
Defined in:
lib/kan/abilities_list.rb

Constant Summary collapse

ROLES_DETECT =
'roles'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(name, list) ⇒ AbilitiesList

Returns a new instance of AbilitiesList.



5
6
7
8
# File 'lib/kan/abilities_list.rb', line 5

def initialize(name, list)
  @name = name
  @list = list
end

Instance Method Details

#call(*payload) ⇒ Object



10
11
12
# File 'lib/kan/abilities_list.rb', line 10

def call(*payload)
  @name == ROLES_DETECT ? mapped_roles(payload) : ability_check(payload)
end