Module: CanTango::Ability::Executor

Includes:
CacheHelpers, Helpers::Debug
Included in:
PermissionEngine, PermitEngine, Permits::Executor, UserAcEngine
Defined in:
lib/cantango/ability/executor.rb

Instance Method Summary collapse

Methods included from Helpers::RoleMethods

#config, #has_role_group_meth, #has_role_meth, #role_groups_list_meth, #roles_list_meth

Methods included from Helpers::Debug

#debug

Instance Method Details

#cacheObject



34
35
36
# File 'lib/cantango/ability/executor.rb', line 34

def cache
  @cache ||= CanTango::Ability::Cache.new self, :cache_key => cache_key, :key_method_names => key_method_names
end

#clear_rules!Object



26
27
28
# File 'lib/cantango/ability/executor.rb', line 26

def clear_rules!
  @rules ||= []
end

#engine_nameObject



38
39
40
# File 'lib/cantango/ability/executor.rb', line 38

def engine_name
  :permit
end

#execute!Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cantango/ability/executor.rb', line 9

def execute!
  return if !valid?
  start_execute
  return cached_rules if cached? && cached_rules?

  clear_rules!
  permit_rules

  cache_rules! if cached?
  end_execute
  rules
end

#permit_rulesObject

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/cantango/ability/executor.rb', line 30

def permit_rules
  raise NotImplementedError
end

#rulesObject



22
23
24
# File 'lib/cantango/ability/executor.rb', line 22

def rules
  @rules ||= []
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/cantango/ability/executor.rb', line 42

def valid?
  raise NotImplementedError
end