20
Aug
2014
ruby fun
ok, let's get straight into irb because REPL speaks a thousand words…
1
2
irb> %w_a b c_
=> ['a', 'b', 'c']
That was cryptic…try this
1
2
irb> %i_a b c_
=> [:a, :b, :c]
That save a whole bunch of keystrokes…how about this
1
2
irb> %r_a/b/c_
=> /a\/b\/c/
That makes regular expression with forward slash more readable…in fact there's a whole slew of them %: %q, %x, %
ok, that's enough fun for now.