Class: Dry::Effects::Effects::Random

Inherits:
Module
  • Object
show all
Defined in:
lib/dry/effects/effects/random.rb

Constant Summary collapse

Rand =
Effect.new(type: :random, name: :rand)

Instance Method Summary collapse

Constructor Details

#initializeRandom

Returns a new instance of Random.



9
10
11
12
13
14
15
# File 'lib/dry/effects/effects/random.rb', line 9

def initialize
  super

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