Module: Cancannible

Defined in:
lib/cancannible/config.rb,
lib/cancannible/grantee.rb,
lib/cancannible/version.rb,
lib/generators/cancannible/install_generator.rb

Defined Under Namespace

Modules: ControllerAdditions, Generators, Grantee, PreloadAdapter Classes: Preloader

Constant Summary collapse

VERSION =
'2.1.0'

Class Method Summary collapse

Class Method Details

.refine_access(refinement = {}) ⇒ Object



21
22
23
24
25
# File 'lib/cancannible/config.rb', line 21

def self.refine_access(refinement={})
  stage = (refinement.delete(:stage) || 1) - 1
  self.refinements[stage] ||= []
  self.refinements[stage] << refinement
end

.reset!Object



14
15
16
17
18
# File 'lib/cancannible/config.rb', line 14

def self.reset!
  self.refinements = []
  self.get_cached_abilities = nil
  self.store_cached_abilities = nil
end

.setup {|_self| ... } ⇒ Object

Default way to configure the gem. Yields a block that gives access to all the config variables. Calling setup will reset all existing values.

Yields:

  • (_self)

Yield Parameters:

  • _self (Cancannible)

    the object that the method was called on



8
9
10
11
12
# File 'lib/cancannible/config.rb', line 8

def self.setup
  reset!
  yield self
  self
end