RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

Generate fuzzy numbers and times with 'ish'

I built ish because I liked the idea of this syntax for fuzzy dates and times:

2.hours.ish # 7379 seconds # a day from now plus/minus 5 min

If you want to randomly generate some integers between 5 and 15 you could specify an offset:

10.ish(offset: 5) # => 7

Or a random price around $10:

(10.0).ish.round(2) # => 10.17

Anyhoo, give it a try if you want :)


Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!