Class: Rambling::Trie::Readers::PlainText

Inherits:
Object
  • Object
show all
Defined in:
lib/rambling/trie/readers/plain_text.rb

Overview

File reader for .txt files.

Instance Method Summary collapse

Instance Method Details

#each_word(filepath) {|String| ... } ⇒ Object

Yields each word read from a .txt file.

Parameters:

  • filepath (String)

    the full path of the file to load the words from.

Yields:

  • (String)

    Each line read from the file.


12
13
14
# File 'lib/rambling/trie/readers/plain_text.rb', line 12

def each_word filepath
  File.foreach(filepath) { |line| yield line.chomp! }
end