Class: Dry::Effects::Effects::Random
- Inherits:
-
Module
- Object
- Module
- Dry::Effects::Effects::Random
- Defined in:
- lib/dry/effects/effects/random.rb
Constant Summary collapse
- Rand =
Effect.new(type: :random, name: :rand)
Instance Method Summary collapse
-
#initialize ⇒ Random
constructor
A new instance of Random.
Constructor Details
#initialize ⇒ Random
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 |