Sha256: b37559a9e1326095d81a875d0a85daa2565ee983fc19bfa9f6264ac855c7bf05

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 Bytes

Contents

module CanTango::Api
  module Scope
    module Account
      include CanTango::Api::Ability::Account
      
      def scope_account scope, options = {}, &block
        account = scoped_account(scope)
        ab_scope = account_ability_scope(account, options)
        yield ab_scope if block
        ab_scope
      end
      alias_method :account_scope, :scope_account

      def real_account scope, options = {}, &block
        scope_account scope, options.merge(:masquerade => false), &block
      end

      protected

      def account_ability_scope account, options = {}
        CanTango::Scope::Ability.new account_ability(account, options)
      end

      def scoped_account scope
        send(:"current_#{scope}_account")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cantango-api-0.1.3 lib/cantango/api/scope/account.rb
cantango-api-0.1.2 lib/cantango/api/scope/account.rb
cantango-api-0.1.1 lib/cantango/api/scope/account.rb