Sha256: bb483f74124b5adae0e08c247affd8714228cd6ab28bf38cab8496d04cbbda5a

Contents?: true

Size: 427 Bytes

Versions: 3

Compression:

Stored size: 427 Bytes

Contents

# frozen_string_literal: true

require 'dry/monads/result'

module Lamassu
  module PolicyAdapters
    # Policy Adapter for a callable wrapping returned value to Success
    class Map
      include Dry::Monads::Result::Mixin

      attr_reader :policy

      def initialize(policy)
        @policy = policy
      end

      def call(*args)
        value = policy.call(*args)

        Success(value)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lamassu-0.2.0 lib/lamassu/policy_adapters/map.rb
lamassu-0.1.1 lib/lamassu/policy_adapters/map.rb
lamassu-0.1.0 lib/lamassu/policy_adapters/map.rb