Sha256: f50807ec624b87fc2628e639c3c6c29476e1b1d3e78c19a6fd282f68c48d50ff

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

require 'dry/effects/effect'

module Dry
  module Effects
    module Effects
      class Amb < ::Module
        class AmbEffect < Effect
          option :id
        end

        def initialize(id)
          get = AmbEffect.new(type: :amb, name: :get, id: id)

          module_eval do
            define_method(:"#{id}?") { ::Dry::Effects.yield(get) }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-effects-0.1.0.alpha2 lib/dry/effects/effects/amb.rb
dry-effects-0.1.0.alpha lib/dry/effects/effects/amb.rb