Skip to content

Instantly share code, notes, and snippets.

@cantlin
Created August 7, 2011 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cantlin/1130805 to your computer and use it in GitHub Desktop.
Save cantlin/1130805 to your computer and use it in GitHub Desktop.
class Dictionary
def initialize
@words = read_source
end
def include? word
self.words.include? word
end
def include_any? words
words.each do |word|
return word if self.include? word
end
false
end
def words
@words
end
def words=(value)
@words = value
end
private
def read_source
IO.readlines '/usr/share/dict/words'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment