Skip to content

Instantly share code, notes, and snippets.

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

  • Save manleyhimself/6868196 to your computer and use it in GitHub Desktop.

Select an option

Save manleyhimself/6868196 to your computer and use it in GitHub Desktop.
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(array)
@word = @word.split("").sort
array.select { |element| element.split("").sort == @word }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment