Sha256: 93ef785f1ecd51a4b11ac3774afad7f9d42a3299d5e53aa56ba5f876b6accea3

Contents?: true

Size: 474 Bytes

Versions: 8

Compression:

Stored size: 474 Bytes

Contents

# frozen_string_literal: true

module Rambling
  module Trie
    module Readers
      # File reader for .txt files.
      class PlainText
        # 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
          File.foreach(filepath) { |line| yield line.chomp! }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rambling-trie-2.3.0 lib/rambling/trie/readers/plain_text.rb
rambling-trie-2.2.1 lib/rambling/trie/readers/plain_text.rb
rambling-trie-2.2.0 lib/rambling/trie/readers/plain_text.rb
rambling-trie-opal-2.1.1.1 lib/rambling/trie/readers/plain_text.rb
rambling-trie-opal-2.1.1 lib/rambling/trie/readers/plain_text.rb
rambling-trie-2.1.1 lib/rambling/trie/readers/plain_text.rb
rambling-trie-2.1.0 lib/rambling/trie/readers/plain_text.rb
rambling-trie-2.0.0 lib/rambling/trie/readers/plain_text.rb