Class: Properb::Generator
- Inherits:
-
Object
- Object
- Properb::Generator
show all
- Defined in:
- lib/properb/generator.rb
Direct Known Subclasses
Properb::Generators::ArrayGenerator, Properb::Generators::ChoiceGenerator, Properb::Generators::ConstantGenerator, Properb::Generators::DeferredGenerator, Properb::Generators::FrequenciesGenerator, Properb::Generators::IntegerGenerator, Properb::Generators::MappedGenerator, Properb::Generators::RecursiveGenerator, Properb::Generators::SelectedGenerator, Properb::Generators::SizedGenerator, Properb::Generators::TupleGenerator
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_generator ⇒ Object
3
4
5
|
# File 'lib/properb/generator.rb', line 3
def to_properb_generator
self
end
|