Skip to content

Instantly share code, notes, and snippets.

@TrevMcKendrick
Created October 11, 2013 15:45
Show Gist options
  • Save TrevMcKendrick/6937062 to your computer and use it in GitHub Desktop.
Save TrevMcKendrick/6937062 to your computer and use it in GitHub Desktop.
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(target_array)
target_array.select do |target_word|
@word if @word.chars.sort == target_word.chars.sort
end
end
end
#puts test_array("listen", %w(enlists google inlets banana) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment