Skip to content

Instantly share code, notes, and snippets.

@marcosanson
Created July 21, 2010 18:23
Show Gist options
  • Save marcosanson/484888 to your computer and use it in GitHub Desktop.
Save marcosanson/484888 to your computer and use it in GitHub Desktop.
WORDS = [ [ "husband", "wife" ], [ "brother", "sister"], [ "uncle", "nephew" ] ]
class String
def opposite
WORDS[WORDS.flatten.index(self)/2][WORDS.flatten.index(self)%2 == 0 ? 1 : 0]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment