Skip to content

Instantly share code, notes, and snippets.

@rosiehoyem
Created October 7, 2013 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosiehoyem/6869518 to your computer and use it in GitHub Desktop.
Save rosiehoyem/6869518 to your computer and use it in GitHub Desktop.
Anagram TO DO for Monday, October 7.
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(array)
@word = @word.chars.sort
array.select { |element| element.chars.sort == @word }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment