Sha256: 3ae458a08cd6fb63ee0dea40e84a9996a747d05aef73afb7d1ab14233b773ecf
Contents?: true
Size: 983 Bytes
Versions: 3
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true # ActionPolicy is an authorization framework for Ruby/Rails applications. # # It provides a way to write access policies and helpers to check these policies # in your application. module ActionPolicy class Error < StandardError; end # Raised when Action Policy fails to find a policy class for a record. class NotFound < Error attr_reader :target, :message def initialize(target) @target = target @message = "Couldn't find policy class for #{target.inspect}" end end require "action_policy/version" require "action_policy/base" require "action_policy/lookup_chain" require "action_policy/authorizer" require "action_policy/behaviour" class << self attr_accessor :cache_store # Find a policy class for a target def lookup(target, **options) LookupChain.call(target, **options) || raise(NotFound, target) end end require "action_policy/railtie" if defined?(::Rails) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
action_policy-0.1.2 | lib/action_policy.rb |
action_policy-0.1.1 | lib/action_policy.rb |
action_policy-0.1.0 | lib/action_policy.rb |