Recent Posts

Regexp anchors in Ruby

1 minute read

Some Rubyists, when faced with the task of matching against the beginning or the end of a string, are prone to using ^ and $ in their regular expressions. Mo...

Using Ruby’s gsub with a hash

less than 1 minute read

Recently we discussed how you can use String#gsub with a block. Today we’ll examine another somewhat unknown feature of the gsub method - the ability to supp...

Lambdas/Procs in Case Expressions

1 minute read

Most Rubyists know they can use literals, classes, ranges and regular expressions in the when branches of a case expression: