Sha256: f23e712bf1e56f099daeb2bdf70df250a9273b7969a1abc45f2d3be53829a803

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

require 'forwardable'
%w{
  branches compressor enumerable
  inspector invalid_operation node
  plain_text_reader root version
}.map { |file| File.join 'rambling', 'trie', file }.each &method(:require)

# General namespace for all Rambling gems.
module Rambling
  # Entry point for rambling-trie API.
  module Trie
    class << self
      # Creates a new Trie. Entry point for the Rambling::Trie API.
      # @param [String, nil] filepath the file to load the words from.
      # @return [Root] the trie just created.
      # @yield [Root] the trie just created.
      def create(filepath = nil, reader = PlainTextReader.new)
        Root.new do |root|
          reader.each_word(filepath) { |word| root << word } if filepath
          yield root if block_given?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rambling-trie-0.6.1 lib/rambling/trie.rb
rambling-trie-0.6.0 lib/rambling/trie.rb