Sha256: e5aa2b16a83b32eb5016669029c819c68f3099060cbb2241e974663e22abfff7

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Effects
    class Handler
      attr_reader :provider

      attr_reader :frame

      def initialize(type, *args)
        @provider = ::Dry::Effects.providers[type].new(*args)
        @frame = Frame.new(provider)
      end

      def call(*args, &block)
        frame.(args, &block)
      end

      def to_s
        "#<Dry::Effects::Handler #{provider.represent}>"
      end
      alias_method :inspect, :to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-effects-0.1.1 lib/dry/effects/handler.rb
dry-effects-0.1.0 lib/dry/effects/handler.rb