Created
August 7, 2011 21:16
-
-
Save cantlin/1130805 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 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