class Syzygies::Wordlist

Attributes

list[RW]

Public Class Methods

new() click to toggle source
# File lib/syzygies/wordlist.rb, line 20
def initialize
        if WORD_LIST.nil?
                $stderr.puts """
                Please set an enviroment variable with the path to the wordlist:
                
                  export WORD_LIST=/path/to/your/wordlist.txt
                """
                exit(-1)
        end
        @list = File.read(WORD_LIST).split("\r\n").select { |word| word.length > 2 } .collect { |word| Word.new word }
end

Public Instance Methods

get(word) click to toggle source
# File lib/syzygies/wordlist.rb, line 32
def get(word)
        list = @list.select { |w| !(word.parents.include? w.word ) && ( w.first_two_letters == word.last_two_letters || w.last_two_letters == word.first_two_letters )  }
        return list
end