Skip to content

Instantly share code, notes, and snippets.

@JamesZoft
Created June 15, 2012 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesZoft/2935767 to your computer and use it in GitHub Desktop.
Save JamesZoft/2935767 to your computer and use it in GitHub Desktop.
1.9.3-p125 :008 > replacements = [ "hello", "test" ] => ["hello", "test"]
1.9.3-p125 :009 > new_str = replacements.reduce(){|str, (old, new)| str.gsub old, new}
TypeError: can't convert nil into String
from (irb):9:in `gsub'
from (irb):9:in `block in irb_binding'
from (irb):9:in `each'
from (irb):9:in `reduce'
from (irb):9
from ~/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment