Class: Properb::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/properb/generator.rb

Instance Method Summary collapse

Instance Method Details

#map(&block) ⇒ Object



7
8
9
# File 'lib/properb/generator.rb', line 7

def map(&block)
  Generators::MappedGenerator.new(self, &block)
end

#or(generator) ⇒ Object



21
22
23
# File 'lib/properb/generator.rb', line 21

def or(generator)
  Generators::ChoiceGenerator.new([self, Generators.gen(generator)])
end

#reject(num_attempts: 10, &block) ⇒ Object



15
16
17
18
19
# File 'lib/properb/generator.rb', line 15

def reject(num_attempts: 10, &block)
  select(num_attempts: num_attempts) do |*args|
    !block.call(*args)
  end
end

#select(num_attempts: 10, &block) ⇒ Object



11
12
13
# File 'lib/properb/generator.rb', line 11

def select(num_attempts: 10, &block)
  Generators::SelectedGenerator.new(self, num_attempts: num_attempts, &block)
end

#sized(size) ⇒ Object



25
26
27
# File 'lib/properb/generator.rb', line 25

def sized(size)
  Generators::SizedGenerator.new(self, size)
end

#to_properb_generatorObject



3
4
5
# File 'lib/properb/generator.rb', line 3

def to_properb_generator
  self
end