Skip to content

Instantly share code, notes, and snippets.

@gregeng
Created October 14, 2013 15:14
anagram
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
%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