Sha256: 3347feb650e207d9c3107ab4f87c4714d088e4d0dab371fecb77b6278c3a5a87

Contents?: true

Size: 373 Bytes

Versions: 1

Compression:

Stored size: 373 Bytes

Contents

# frozen_string_literal: true

require 'dry/effects/effect'

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-effects-0.1.3 lib/dry/effects/effects/random.rb