Sha256: 5ac0a2fd6ef459945665cffb3db83e30c28f4352e822dfc92b5561e9cfc2c5ed

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

require 'cantango'
require 'cantango/permit_engine/util'

module CanTango
  class Ability
    def initialize candidate, options = {}
      puts "\n\n! Using test variant of CanTango::Ability from spec/helpers !\n\n"
      raise "Candidate must be something!" if !candidate
      @candidate, @options = candidate, options
      @session = options[:session] || {} # seperate session cache for each type of user?

      @rules_cached = true and return if cached_rules?

      # run permission evaluators
      with(:permissions)  {|permission| permission.evaluate! user }
      with(:permits)      {|permit| break if permit.execute == :break }

      cache_rules!
    end
  
    def rules_cached?
      @rules_cached || false
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 spec/helpers/dummy_app_ability.rb