just some doc fixes to make it easier to get started #1

1 commit merged into from Jan 10, 2011


None yet
2 participants

mwotton commented Jan 5, 2011

nice to see a semi-actively-maintained quickcheck-alike in ruby again, even if it is explicitly impure:)


hayeah commented Jan 10, 2011

hey mark, i fixed the doc to reflect some of the helpers you can use:

Rantly { integer } # => 10
Rantly(3) { integer } # => [301,4109401,12399] # or whatever


mwotton commented Jan 10, 2011

Terrific, that looks much better.
I still need to work out how to write a generator that makes arbitrary hashes, but that can wait for another day. Thanks!


hayeah commented Jan 10, 2011

Rantly { dict { [string,integer] }}
"-Mp '."=>653206579583741142,
"= :/,"=>433790301059833691}

it can be implemented with a one-liner

def dict(n,&block)
array(n,&block).inject({}) {|h,(k,v)| h[k] = v; h }

But that doesn't check for uniqueness of key. So I did another version that uses guard to retry if the generated key had been used.


mwotton commented Jan 11, 2011

hah, lovely. thank you.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment