Skip to content

Instantly share code, notes, and snippets.

View stevehorn's full-sized avatar

Steve Horn stevehorn

  • Columbus, OH, USA
View GitHub Profile
s = "sample string"
replacements = { "a" => "i", "tring" => "ubstitution" }
#why is the "&" necessary before the s variable?
replacements.collect(&s.method(:gsub))
# => ["simple string", "sample substitution"]