class Rambling::Trie::Readers::PlainText

File reader for .txt files.

Public Instance Methods

each_word(filepath) { |chomp!| ... } click to toggle source

Yields each word read from a .txt file. @param [String] filepath the full path of the file to load the words

from.

@yield [String] Each line read from the file. @return [self]

# File lib/rambling/trie/readers/plain_text.rb, line 13
def each_word filepath
  return enum_for :each_word unless block_given?

  ::File.foreach(filepath) { |line| yield line.chomp! }

  self
end