Created
October 11, 2013 15:45
-
-
Save TrevMcKendrick/6937062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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