Skip to content

Instantly share code, notes, and snippets.

@ivanbrennan
Last active December 24, 2015 21:39
Show Gist options
  • Select an option

  • Save ivanbrennan/6867479 to your computer and use it in GitHub Desktop.

Select an option

Save ivanbrennan/6867479 to your computer and use it in GitHub Desktop.
Anagrams
class Anagram
attr_reader :word
def initialize(word)
@word = word
end
def match(strings)
strings.select do |string|
string.chars.sort == word.chars.sort
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment