Sha256: 6d5a2b0488cc1a24a13f7efef9ba11378a8fc1b7bd71cf1e794433e8102bc66b
Contents?: true
Size: 598 Bytes
Versions: 4
Compression:
Stored size: 598 Bytes
Contents
module Rambling module Trie # File reader for .txt files class PlainTextReader # 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. def each_word filepath each_line(filepath) { |line| yield line.chomp! } end private def each_line filepath open(filepath) { |file| file.each_line { |line| yield line } } end def open filepath File.open(filepath) { |file| yield file } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems