RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

xunker — 4 posts

The best jokes have have a huge build-up to the punch line. My build-up is writing a whole gem, Array-subindex, and the punch line is being able to index an array with classes of number other than integers. Confuse your friends and astound your enemies with code like this:

> [ 1, 2 ][0.5]
> # => 1.5

> [ 1, 2, 3 ][Rational(2,3)]
> # => 2.5

> %w[ foo bar baz ][1.5]
> # => "arb"

It's fun for the whole family and breaks the ice at parties!
Technologies like HtmlUnit and Capybara-webkit are amazing tools, but are they the best choice in all cases? In situations such as full-stack testing of your web app, I argue they are not.
After adding JSON API capability to an existing Rails' site I needed to write API documentation. I hate writing docs, and I bet you do too. So I figured out a way to have Cucumber do it for me.
validate_block is a Ruby gem designed to make the 'validates_*' declarations in ActiveRecord modules a little less repetitive, DRYer a bit more scope-able.