lib/prop_check/generator.rb in prop_check-0.10.4 vs lib/prop_check/generator.rb in prop_check-0.11.0
- old
+ new
@@ -98,20 +98,18 @@
# >> Generators.choose(32..128).map(&:chr).call(10, Random.new(42))
# => "S"
def map(&proc)
Generator.new do |size, rng|
result = self.generate(size, rng)
- result.map do |*val|
- proc.call(*val)
- end
+ result.map(&proc)
end
end
##
# Creates a new Generator that only produces a value when the block `condition` returns a truthy value.
def where(&condition)
- self.map do |*result|
- if condition.call(*result)
+ self.map do |result|
+ if condition.call(result)
result
else
:"_PropCheck.filter_me"
end
end