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 =
"0.0.2"

Class Method Summary collapse

Class Method Details

.refine_access(refinement = {}) ⇒ Object



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

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

.reset!Object



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

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



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

def self.setup
  reset!
  yield self
  self
end