Sha256: 35d35fa12027e5aaa811b5bdf0e017929a1956a41f3fe32458f509ef96df49c2
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
# frozen_string_literal: true module Logux class PolicyCaller extend Forwardable attr_reader :action, :meta def_delegators :Logux, :logger, :configuration def initialize(action:, meta:) @action = action @meta = meta end def call! logger.debug('Searching policy for Logux action:' \ " #{action}, meta: #{meta}") policy.public_send("#{action.action_type}?") rescue Logux::UnknownActionError, Logux::UnknownChannelError => e raise e if configuration.verify_authorized logger.warn(e) end private def class_finder @class_finder ||= Logux::ClassFinder.new(action: action, meta: meta) end def policy class_finder.find_policy_class.new(action: action, meta: meta) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logux-rack-0.1.0 | lib/logux/policy_caller.rb |