Sha256: 089ada3a6136131e3b8a16be0666b7d05a0d1e87a4e4e074ccfbb8812b37c845

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

require 'active_support/concern'

module SnFoil
  module Policy
    extend ActiveSupport::Concern

    attr_reader :record, :entity
    attr_accessor :options

    def initialize(entity, record, options = {})
      @record = record
      @entity = entity
      @options = options
    end

    def index?
      false
    end

    def show?
      false
    end

    def create?
      false
    end

    def update?
      false
    end

    def destroy?
      false
    end

    def associate?
      false
    end

    class Scope
      attr_reader :scope, :entity

      def initialize(scope, entity = nil)
        @entity = entity
        @scope = scope
      end

      def resolve
        scope.all
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snfoil-0.9.0 lib/sn_foil/policy.rb
snfoil-0.8.5 lib/sn_foil/policy.rb
snfoil-0.8.4 lib/sn_foil/policy.rb
snfoil-0.8.3 lib/sn_foil/policy.rb
snfoil-0.8.2 lib/sn_foil/policy.rb
snfoil-0.8.1 lib/sn_foil/policy.rb