Skip to content

Instantly share code, notes, and snippets.

@ethangunderson
Created May 6, 2015 01:09
Show Gist options
  • Save ethangunderson/d1e41e88406fe56e7136 to your computer and use it in GitHub Desktop.
Save ethangunderson/d1e41e88406fe56e7136 to your computer and use it in GitHub Desktop.
words_to_redact = ["foo", "bar"]
sentance = "This is a sentance to redact, foo"
words = sentance.split(" ")
words.map do |word|
if words_to_redact.include?(word)
"REDACTED"
else
word
end
end.join(" ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment