class WordListSanitizer
  def initialize
    @words ||= File.new(file_path).readlines.map(&:chomp)
  end

  def run!
    process_words
    write_file
  end

  private
  def file_path
    File.dirname(__FILE__) + '/../data/words.txt'
  end

  def process_words
    @processed = @words.reject { |w| w.match(/^\w+$/).nil? }.map(&:downcase).sort.uniq
  end

  def write_file
    File.open(file_path, 'w') { |f| @processed.each { |w| f.puts(w) } }
  end
end

class WordListSanitizer
  def initialize
    @words ||= File.new(file_path).readlines.map(&:chomp)
  end

  def run!
    update_word_file
  end

  private
  def file_path
    File.dirname(__FILE__) + '/../data/words.txt'
  end

  def processed_words
    @words.reject { |w| w.match(/^\w+$/).nil? }.map(&:downcase).sort.uniq
  end

  def update_word_file
    File.open(file_path, 'w') { |f| processed_words.each { |w| f.puts(w) } }
  end
end

Clean up word file sanitizer a bit
Clean up word file sanitizer a bit
