Skip to content

Instantly share code, notes, and snippets.

@bkerley
Forked from capotej/grep_safe.rb
Created November 22, 2010 03:56
Show Gist options
  • Save bkerley/709495 to your computer and use it in GitHub Desktop.
Save bkerley/709495 to your computer and use it in GitHub Desktop.
# turns hey => "[h]ey"
def grep_safe(path)
"[#{path.chars.first}]#{path.chars.to_a.slice(1, path.chars.count).join}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment