Sha256: f7ec9188d808b0323ac475b7b97a92cd4feefdeac526e83304c198a0099e0c89
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
# frozen_string_literal: true require 'dry-monads' module CleanArchitecture module Strategies class ActorGetsAuthorizedThenDoesWork extend Forwardable implements_interface Interfaces::Strategy def initialize(authorization_check, sub_strategy) @authorization_check = authorization_check @sub_strategy = sub_strategy end def_delegator :@sub_strategy, :parameters def result @result ||= begin if @authorization_check.authorized? @sub_strategy.result else Dry::Monads::Failure('Unauthorized: Invalid API key') end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clean-architecture-0.0.1 | lib/clean_architecture/strategies/actor_gets_authorized_then_does_work.rb |