Skip to content

Instantly share code, notes, and snippets.

@gregeng
Created October 14, 2013 15:14
Show Gist options
  • Save gregeng/6977245 to your computer and use it in GitHub Desktop.
Save gregeng/6977245 to your computer and use it in GitHub Desktop.
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