Created
October 14, 2013 15:14
anagram
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
require 'pry' | |
class Anagram | |
attr_reader :word | |
def initialize(word) | |
@word = word | |
end | |
def match(array=%w(hello world zombies pants)) | |
array.select do |item| | |
item.split(//).sort == word.split(//).sort | |
end | |
end | |
end |
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
%w(gallery ballerina regally clergy largely leading) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment