Sha256: e909cb6984ea415fe1b5f17b67fa3f0d792b5ca616f3f436f054bfc3932eb71d

Contents?: true

Size: 380 Bytes

Versions: 2

Compression:

Stored size: 380 Bytes

Contents

# frozen_string_literal: true

require 'dry/effects/effect'

module Dry
  module Effects
    module Effects
      class Random < ::Module
        Rand = Effect.new(type: :random, name: :rand)

        def initialize
          module_eval do
            define_method(:rand) { |n = nil| ::Dry::Effects.yield(Rand.payload(n)) }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-effects-0.1.5 lib/dry/effects/effects/random.rb
dry-effects-0.1.4 lib/dry/effects/effects/random.rb