Sha256: 2672266b9875ee1b23f4b3e590308590fa6d19c5d5b439b03e499a013c5adba8
Contents?: true
Size: 885 Bytes
Versions: 1
Compression:
Stored size: 885 Bytes
Contents
%w{ invalid_operation children_hash_deferer compressor branches enumerable inspector node 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] filename the file to load the words from. # @return [Root] the trie just created. # @yield [Root] the trie just created. def create(filename = nil) Root.new do |root| words_from(filename) { |word| root << word } if filename yield root if block_given? end end private def words_from(filename) File.open(filename) { |file| file.each_line { |line| yield line.chomp } } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rambling-trie-0.5.0 | lib/rambling/trie.rb |