Sha256: d04fcd86520108b06e83513503ca1478a6366779fe955b2ba83bcf3d76692eb0

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

module Cancannible
  mattr_accessor :refinements
  mattr_accessor :get_cached_abilities
  mattr_accessor :store_cached_abilities

  # Default way to configure the gem. Yields a block that gives access to all the config variables.
  # Calling setup will reset all existing values.
  def self.setup
    reset!
    yield self
    self
  end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cancannible-2.1.0 lib/cancannible/config.rb
cancannible-2.0.0 lib/cancannible/config.rb