rambling-trie 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +133 -26
- data/Rakefile +1 -2
- data/lib/rambling/trie.rb +53 -9
- data/lib/rambling/trie/comparable.rb +16 -0
- data/lib/rambling/trie/compressable.rb +14 -0
- data/lib/rambling/trie/compressed_node.rb +38 -14
- data/lib/rambling/trie/compressor.rb +14 -10
- data/lib/rambling/trie/configuration.rb +11 -0
- data/lib/rambling/trie/configuration/properties.rb +66 -0
- data/lib/rambling/trie/configuration/provider_collection.rb +101 -0
- data/lib/rambling/trie/container.rb +57 -17
- data/lib/rambling/trie/enumerable.rb +1 -1
- data/lib/rambling/trie/forwardable.rb +9 -4
- data/lib/rambling/trie/inspectable.rb +37 -0
- data/lib/rambling/trie/invalid_operation.rb +3 -2
- data/lib/rambling/trie/missing_node.rb +2 -1
- data/lib/rambling/trie/node.rb +40 -30
- data/lib/rambling/trie/raw_node.rb +29 -13
- data/lib/rambling/trie/readers.rb +11 -0
- data/lib/rambling/trie/readers/plain_text.rb +26 -0
- data/lib/rambling/trie/serializers.rb +11 -0
- data/lib/rambling/trie/serializers/file.rb +25 -0
- data/lib/rambling/trie/serializers/marshal.rb +38 -0
- data/lib/rambling/trie/serializers/yaml.rb +39 -0
- data/lib/rambling/trie/serializers/zip.rb +67 -0
- data/lib/rambling/trie/stringifyable.rb +20 -0
- data/lib/rambling/trie/version.rb +1 -1
- data/rambling-trie.gemspec +2 -2
- data/spec/integration/rambling/trie_spec.rb +45 -49
- data/spec/lib/rambling/trie/comparable_spec.rb +104 -0
- data/spec/lib/rambling/trie/compressed_node_spec.rb +44 -0
- data/spec/lib/rambling/trie/configuration/properties_spec.rb +49 -0
- data/spec/lib/rambling/trie/configuration/provider_collection_spec.rb +165 -0
- data/spec/lib/rambling/trie/container_spec.rb +127 -38
- data/spec/lib/rambling/trie/{inspector_spec.rb → inspectable_spec.rb} +7 -5
- data/spec/lib/rambling/trie/raw_node_spec.rb +22 -41
- data/spec/lib/rambling/trie/readers/plain_text_spec.rb +14 -0
- data/spec/lib/rambling/trie/serializers/file_spec.rb +11 -0
- data/spec/lib/rambling/trie/serializers/marshal_spec.rb +14 -0
- data/spec/lib/rambling/trie/serializers/yaml_spec.rb +14 -0
- data/spec/lib/rambling/trie/serializers/zip_spec.rb +30 -0
- data/spec/lib/rambling/trie/stringifyable_spec.rb +82 -0
- data/spec/lib/rambling/trie_spec.rb +120 -7
- data/spec/spec_helper.rb +7 -1
- data/spec/support/config.rb +5 -0
- data/spec/support/shared_examples/a_compressable_trie.rb +26 -0
- data/spec/support/shared_examples/a_serializable_trie.rb +26 -0
- data/spec/support/shared_examples/a_serializer.rb +29 -0
- data/spec/support/shared_examples/a_trie_data_structure.rb +29 -0
- data/spec/tmp/.gitkeep +0 -0
- metadata +51 -24
- data/lib/rambling/trie/compression.rb +0 -13
- data/lib/rambling/trie/inspector.rb +0 -11
- data/lib/rambling/trie/plain_text_reader.rb +0 -23
- data/lib/rambling/trie/tasks/gem.rb +0 -17
- data/lib/rambling/trie/tasks/helpers/path.rb +0 -17
- data/lib/rambling/trie/tasks/helpers/performance_report.rb +0 -17
- data/lib/rambling/trie/tasks/helpers/time.rb +0 -7
- data/lib/rambling/trie/tasks/performance.rb +0 -15
- data/lib/rambling/trie/tasks/performance/all.rb +0 -17
- data/lib/rambling/trie/tasks/performance/benchmark.rb +0 -201
- data/lib/rambling/trie/tasks/performance/directory.rb +0 -11
- data/lib/rambling/trie/tasks/performance/flamegraph.rb +0 -119
- data/lib/rambling/trie/tasks/performance/profile/call_tree.rb +0 -147
- data/lib/rambling/trie/tasks/performance/profile/memory.rb +0 -143
- data/spec/lib/rambling/trie/plain_text_reader_spec.rb +0 -18
| @@ -2,7 +2,9 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Rambling::Trie do
         | 
| 4 4 | 
             
              describe '.create' do
         | 
| 5 | 
            -
                let(: | 
| 5 | 
            +
                let(:root) { Rambling::Trie::RawNode.new }
         | 
| 6 | 
            +
                let(:compressor) { Rambling::Trie::Compressor.new }
         | 
| 7 | 
            +
                let!(:container) { Rambling::Trie::Container.new root, compressor }
         | 
| 6 8 |  | 
| 7 9 | 
             
                before do
         | 
| 8 10 | 
             
                  allow(Rambling::Trie::Container).to receive(:new)
         | 
| @@ -16,9 +18,9 @@ describe Rambling::Trie do | |
| 16 18 |  | 
| 17 19 | 
             
                context 'with a block' do
         | 
| 18 20 | 
             
                  it 'yields the new container' do
         | 
| 19 | 
            -
                     | 
| 20 | 
            -
                    Rambling::Trie.create { |trie|  | 
| 21 | 
            -
                    expect( | 
| 21 | 
            +
                    yielded = nil
         | 
| 22 | 
            +
                    Rambling::Trie.create { |trie| yielded = trie }
         | 
| 23 | 
            +
                    expect(yielded).to eq container
         | 
| 22 24 | 
             
                  end
         | 
| 23 25 | 
             
                end
         | 
| 24 26 |  | 
| @@ -48,15 +50,126 @@ describe Rambling::Trie do | |
| 48 50 | 
             
                  let(:reader) { double :reader, each_word: nil }
         | 
| 49 51 |  | 
| 50 52 | 
             
                  before do
         | 
| 51 | 
            -
                     | 
| 52 | 
            -
                      . | 
| 53 | 
            +
                    Rambling::Trie.config do |c|
         | 
| 54 | 
            +
                      c.readers.add :default, reader
         | 
| 55 | 
            +
                      c.readers.default = reader
         | 
| 56 | 
            +
                    end
         | 
| 53 57 | 
             
                  end
         | 
| 54 58 |  | 
| 55 | 
            -
                  it 'defaults to  | 
| 59 | 
            +
                  it 'defaults to a plain text reader' do
         | 
| 56 60 | 
             
                    Rambling::Trie.create filepath, nil
         | 
| 57 61 |  | 
| 58 62 | 
             
                    expect(reader).to have_received(:each_word).with filepath
         | 
| 59 63 | 
             
                  end
         | 
| 60 64 | 
             
                end
         | 
| 61 65 | 
             
              end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
              describe '.load' do
         | 
| 68 | 
            +
                let(:root) { Rambling::Trie::RawNode.new }
         | 
| 69 | 
            +
                let(:compressor) { Rambling::Trie::Compressor.new }
         | 
| 70 | 
            +
                let(:container) { Rambling::Trie::Container.new root, compressor }
         | 
| 71 | 
            +
                let(:serializer) { double :serializer, load: root }
         | 
| 72 | 
            +
                let(:filepath) { 'a path to a file' }
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                it 'returns a new container with the loaded root node' do
         | 
| 75 | 
            +
                  trie = Rambling::Trie.load filepath, serializer
         | 
| 76 | 
            +
                  expect(trie).to eq container
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                it 'uses the serializer to load the root node from the given filepath' do
         | 
| 80 | 
            +
                  trie = Rambling::Trie.load filepath, serializer
         | 
| 81 | 
            +
                  expect(serializer).to have_received(:load).with filepath
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                context 'without a serializer' do
         | 
| 85 | 
            +
                  let(:marshal_serializer) { double :marshal_serializer, load: nil }
         | 
| 86 | 
            +
                  let(:default_serializer) { double :default_serializer, load: nil }
         | 
| 87 | 
            +
                  let(:yaml_serializer) { double :yaml_serializer, load: nil }
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                  before do
         | 
| 90 | 
            +
                    Rambling::Trie.config do |c|
         | 
| 91 | 
            +
                      c.serializers.add :default, default_serializer
         | 
| 92 | 
            +
                      c.serializers.add :marshal, marshal_serializer
         | 
| 93 | 
            +
                      c.serializers.add :yml, yaml_serializer
         | 
| 94 | 
            +
                      c.serializers.add :yaml, yaml_serializer
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                      c.serializers.default = default_serializer
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  it 'determines the serializer based on the file extension' do
         | 
| 101 | 
            +
                    trie = Rambling::Trie.load 'test.marshal'
         | 
| 102 | 
            +
                    expect(marshal_serializer).to have_received(:load).with 'test.marshal'
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                    trie = Rambling::Trie.load 'test.yml'
         | 
| 105 | 
            +
                    expect(yaml_serializer).to have_received(:load).with 'test.yml'
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                    trie = Rambling::Trie.load 'test.yaml'
         | 
| 108 | 
            +
                    expect(yaml_serializer).to have_received(:load).with 'test.yaml'
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                    trie = Rambling::Trie.load 'test'
         | 
| 111 | 
            +
                    expect(default_serializer).to have_received(:load).with 'test'
         | 
| 112 | 
            +
                  end
         | 
| 113 | 
            +
                end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                context 'with a block' do
         | 
| 116 | 
            +
                  it 'yields the new container' do
         | 
| 117 | 
            +
                    yielded = nil
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                    Rambling::Trie.load filepath, serializer do |trie|
         | 
| 120 | 
            +
                      yielded = trie
         | 
| 121 | 
            +
                    end
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                    expect(yielded).to eq container
         | 
| 124 | 
            +
                  end
         | 
| 125 | 
            +
                end
         | 
| 126 | 
            +
              end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
              describe '.dump' do
         | 
| 129 | 
            +
                let(:filename) { 'a trie' }
         | 
| 130 | 
            +
                let(:root) { double :root }
         | 
| 131 | 
            +
                let(:compressor) { double :compressor }
         | 
| 132 | 
            +
                let(:trie) { Rambling::Trie::Container.new root, compressor }
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                let(:marshal_serializer) { double :marshal_serializer, dump: nil }
         | 
| 135 | 
            +
                let(:yaml_serializer) { double :yaml_serializer, dump: nil }
         | 
| 136 | 
            +
                let(:default_serializer) { double :default_serializer, dump: nil }
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                before do
         | 
| 139 | 
            +
                  Rambling::Trie.config do |c|
         | 
| 140 | 
            +
                    c.serializers.add :default, default_serializer
         | 
| 141 | 
            +
                    c.serializers.add :marshal, marshal_serializer
         | 
| 142 | 
            +
                    c.serializers.add :yml, yaml_serializer
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                    c.serializers.default = default_serializer
         | 
| 145 | 
            +
                  end
         | 
| 146 | 
            +
                end
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                it 'uses the configured default serializer by default' do
         | 
| 149 | 
            +
                  Rambling::Trie.dump trie, filename
         | 
| 150 | 
            +
                  expect(default_serializer).to have_received(:dump).with root, filename
         | 
| 151 | 
            +
                end
         | 
| 152 | 
            +
             | 
| 153 | 
            +
                context 'when provided with a format' do
         | 
| 154 | 
            +
                  it 'uses the corresponding serializer' do
         | 
| 155 | 
            +
                    Rambling::Trie.dump trie, "#{filename}.marshal"
         | 
| 156 | 
            +
                    expect(marshal_serializer).to have_received(:dump).with root, "#{filename}.marshal"
         | 
| 157 | 
            +
             | 
| 158 | 
            +
                    Rambling::Trie.dump trie, "#{filename}.yml"
         | 
| 159 | 
            +
                    expect(yaml_serializer).to have_received(:dump).with root, "#{filename}.yml"
         | 
| 160 | 
            +
                  end
         | 
| 161 | 
            +
                end
         | 
| 162 | 
            +
              end
         | 
| 163 | 
            +
             | 
| 164 | 
            +
              describe '.config' do
         | 
| 165 | 
            +
                it 'returns the properties' do
         | 
| 166 | 
            +
                  expect(Rambling::Trie.config).to eq Rambling::Trie.send :properties
         | 
| 167 | 
            +
                end
         | 
| 168 | 
            +
             | 
| 169 | 
            +
                it 'yields the properties' do
         | 
| 170 | 
            +
                  yielded = nil
         | 
| 171 | 
            +
                  Rambling::Trie.config { |c| yielded = c }
         | 
| 172 | 
            +
                  expect(yielded).to eq Rambling::Trie.send :properties
         | 
| 173 | 
            +
                end
         | 
| 174 | 
            +
              end
         | 
| 62 175 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -4,7 +4,7 @@ require 'coveralls' | |
| 4 4 |  | 
| 5 5 | 
             
            Coveralls.wear!
         | 
| 6 6 |  | 
| 7 | 
            -
            SimpleCov. | 
| 7 | 
            +
            SimpleCov.formatters = [
         | 
| 8 8 | 
             
              SimpleCov::Formatter::HTMLFormatter,
         | 
| 9 9 | 
             
              CodeClimate::TestReporter::Formatter,
         | 
| 10 10 | 
             
              Coveralls::SimpleCov::Formatter
         | 
| @@ -26,3 +26,9 @@ RSpec.configure do |config| | |
| 26 26 | 
             
              config.run_all_when_everything_filtered = true
         | 
| 27 27 | 
             
              config.raise_errors_for_deprecations!
         | 
| 28 28 | 
             
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            require 'support/config'
         | 
| 31 | 
            +
            require 'support/shared_examples/a_compressable_trie'
         | 
| 32 | 
            +
            require 'support/shared_examples/a_serializable_trie'
         | 
| 33 | 
            +
            require 'support/shared_examples/a_serializer'
         | 
| 34 | 
            +
            require 'support/shared_examples/a_trie_data_structure'
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            shared_examples_for 'a compressable trie' do
         | 
| 2 | 
            +
              context 'and the trie is not compressed' do
         | 
| 3 | 
            +
                it_behaves_like 'a trie data structure'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                it 'does not alter the input' do
         | 
| 6 | 
            +
                  word = 'string'
         | 
| 7 | 
            +
                  trie.add word
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  expect(word).to eq 'string'
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                it 'is marked as not compressed' do
         | 
| 13 | 
            +
                  expect(trie).not_to be_compressed
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              context 'and the trie is compressed' do
         | 
| 18 | 
            +
                before { trie.compress! }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                it_behaves_like 'a trie data structure'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it 'is marked as compressed' do
         | 
| 23 | 
            +
                  expect(trie).to be_compressed
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            shared_examples_for 'a serializable trie' do
         | 
| 2 | 
            +
              context 'and the trie is not compressed' do
         | 
| 3 | 
            +
                before do
         | 
| 4 | 
            +
                  Rambling::Trie.dump trie_to_serialize, trie_filepath, serializer
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                it_behaves_like 'a compressable trie' do
         | 
| 8 | 
            +
                  let(:trie) { loaded_trie }
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              context 'and the trie is compressed' do
         | 
| 13 | 
            +
                let(:trie) { loaded_trie }
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                before do
         | 
| 16 | 
            +
                  FileUtils.rm_f trie_filepath
         | 
| 17 | 
            +
                  Rambling::Trie.dump trie_to_serialize.compress!, trie_filepath, serializer
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                it_behaves_like 'a trie data structure'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it 'is marked as compressed' do
         | 
| 23 | 
            +
                  expect(trie).to be_compressed
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            shared_examples_for 'a serializer' do
         | 
| 2 | 
            +
              before do
         | 
| 3 | 
            +
                FileUtils.rm_f filepath
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              describe '#dump' do
         | 
| 7 | 
            +
                before do
         | 
| 8 | 
            +
                  serializer.dump content, filepath
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                it 'creates the file with the provided path' do
         | 
| 12 | 
            +
                  expect(File.exist? filepath).to be true
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                it 'converts the contents to the appropriate format' do
         | 
| 16 | 
            +
                  expect(File.read(filepath).size).to eq formatted_content.size
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              describe '#load' do
         | 
| 21 | 
            +
                before do
         | 
| 22 | 
            +
                  serializer.dump content, filepath
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                it 'loads the dumped object back into memory' do
         | 
| 26 | 
            +
                  expect(serializer.load filepath).to eq content
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            shared_examples_for 'a trie data structure' do
         | 
| 2 | 
            +
              it 'contains all the words previously provided' do
         | 
| 3 | 
            +
                words.each do |word|
         | 
| 4 | 
            +
                  expect(trie).to include word
         | 
| 5 | 
            +
                  expect(trie.word? word).to be true
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              it 'matches the start of all the words from the file' do
         | 
| 10 | 
            +
                words.each do |word|
         | 
| 11 | 
            +
                  expect(trie.match? word).to be true
         | 
| 12 | 
            +
                  expect(trie.match? word[0..-2]).to be true
         | 
| 13 | 
            +
                  expect(trie.partial_word? word).to be true
         | 
| 14 | 
            +
                  expect(trie.partial_word? word[0..-2]).to be true
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              it 'identifies words within larger strings' do
         | 
| 19 | 
            +
                words.each do |word|
         | 
| 20 | 
            +
                  phrase = "x#{word}y"
         | 
| 21 | 
            +
                  expect(trie.words_within phrase).to include word
         | 
| 22 | 
            +
                  expect(trie.words_within? phrase).to be true
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              it 'allows iterating over all the words' do
         | 
| 27 | 
            +
                expect(trie.to_a.sort).to eq words.sort
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
    
        data/spec/tmp/.gitkeep
    ADDED
    
    | 
            File without changes
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rambling-trie
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 1.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Edgar Gonzalez
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2017-01- | 
| 12 | 
            +
            date: 2017-01-22 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rspec
         | 
| @@ -53,9 +53,8 @@ dependencies: | |
| 53 53 | 
             
                - - "~>"
         | 
| 54 54 | 
             
                  - !ruby/object:Gem::Version
         | 
| 55 55 | 
             
                    version: 0.9.5
         | 
| 56 | 
            -
            description: The Rambling Trie is a  | 
| 57 | 
            -
               | 
| 58 | 
            -
              to traverse.
         | 
| 56 | 
            +
            description: The Rambling Trie is a Ruby implementation of the trie data structure,
         | 
| 57 | 
            +
              which includes compression abilities and is designed to be very fast to traverse.
         | 
| 59 58 | 
             
            email:
         | 
| 60 59 | 
             
            - edggonzalezg@gmail.com
         | 
| 61 60 | 
             
            - lilibethdlc@gmail.com
         | 
| @@ -70,44 +69,58 @@ files: | |
| 70 69 | 
             
            - Rakefile
         | 
| 71 70 | 
             
            - lib/rambling-trie.rb
         | 
| 72 71 | 
             
            - lib/rambling/trie.rb
         | 
| 72 | 
            +
            - lib/rambling/trie/comparable.rb
         | 
| 73 | 
            +
            - lib/rambling/trie/compressable.rb
         | 
| 73 74 | 
             
            - lib/rambling/trie/compressed_node.rb
         | 
| 74 | 
            -
            - lib/rambling/trie/compression.rb
         | 
| 75 75 | 
             
            - lib/rambling/trie/compressor.rb
         | 
| 76 | 
            +
            - lib/rambling/trie/configuration.rb
         | 
| 77 | 
            +
            - lib/rambling/trie/configuration/properties.rb
         | 
| 78 | 
            +
            - lib/rambling/trie/configuration/provider_collection.rb
         | 
| 76 79 | 
             
            - lib/rambling/trie/container.rb
         | 
| 77 80 | 
             
            - lib/rambling/trie/enumerable.rb
         | 
| 78 81 | 
             
            - lib/rambling/trie/forwardable.rb
         | 
| 79 | 
            -
            - lib/rambling/trie/ | 
| 82 | 
            +
            - lib/rambling/trie/inspectable.rb
         | 
| 80 83 | 
             
            - lib/rambling/trie/invalid_operation.rb
         | 
| 81 84 | 
             
            - lib/rambling/trie/missing_node.rb
         | 
| 82 85 | 
             
            - lib/rambling/trie/node.rb
         | 
| 83 | 
            -
            - lib/rambling/trie/plain_text_reader.rb
         | 
| 84 86 | 
             
            - lib/rambling/trie/raw_node.rb
         | 
| 85 | 
            -
            - lib/rambling/trie/ | 
| 86 | 
            -
            - lib/rambling/trie/ | 
| 87 | 
            -
            - lib/rambling/trie/ | 
| 88 | 
            -
            - lib/rambling/trie/ | 
| 89 | 
            -
            - lib/rambling/trie/ | 
| 90 | 
            -
            - lib/rambling/trie/ | 
| 91 | 
            -
            - lib/rambling/trie/ | 
| 92 | 
            -
            - lib/rambling/trie/ | 
| 93 | 
            -
            - lib/rambling/trie/tasks/performance/flamegraph.rb
         | 
| 94 | 
            -
            - lib/rambling/trie/tasks/performance/profile/call_tree.rb
         | 
| 95 | 
            -
            - lib/rambling/trie/tasks/performance/profile/memory.rb
         | 
| 87 | 
            +
            - lib/rambling/trie/readers.rb
         | 
| 88 | 
            +
            - lib/rambling/trie/readers/plain_text.rb
         | 
| 89 | 
            +
            - lib/rambling/trie/serializers.rb
         | 
| 90 | 
            +
            - lib/rambling/trie/serializers/file.rb
         | 
| 91 | 
            +
            - lib/rambling/trie/serializers/marshal.rb
         | 
| 92 | 
            +
            - lib/rambling/trie/serializers/yaml.rb
         | 
| 93 | 
            +
            - lib/rambling/trie/serializers/zip.rb
         | 
| 94 | 
            +
            - lib/rambling/trie/stringifyable.rb
         | 
| 96 95 | 
             
            - lib/rambling/trie/version.rb
         | 
| 97 96 | 
             
            - rambling-trie.gemspec
         | 
| 98 97 | 
             
            - spec/assets/test_words.en_US.txt
         | 
| 99 98 | 
             
            - spec/assets/test_words.es_DO.txt
         | 
| 100 99 | 
             
            - spec/integration/rambling/trie_spec.rb
         | 
| 100 | 
            +
            - spec/lib/rambling/trie/comparable_spec.rb
         | 
| 101 101 | 
             
            - spec/lib/rambling/trie/compressed_node_spec.rb
         | 
| 102 102 | 
             
            - spec/lib/rambling/trie/compressor_spec.rb
         | 
| 103 | 
            +
            - spec/lib/rambling/trie/configuration/properties_spec.rb
         | 
| 104 | 
            +
            - spec/lib/rambling/trie/configuration/provider_collection_spec.rb
         | 
| 103 105 | 
             
            - spec/lib/rambling/trie/container_spec.rb
         | 
| 104 106 | 
             
            - spec/lib/rambling/trie/enumerable_spec.rb
         | 
| 105 | 
            -
            - spec/lib/rambling/trie/ | 
| 107 | 
            +
            - spec/lib/rambling/trie/inspectable_spec.rb
         | 
| 106 108 | 
             
            - spec/lib/rambling/trie/node_spec.rb
         | 
| 107 | 
            -
            - spec/lib/rambling/trie/plain_text_reader_spec.rb
         | 
| 108 109 | 
             
            - spec/lib/rambling/trie/raw_node_spec.rb
         | 
| 110 | 
            +
            - spec/lib/rambling/trie/readers/plain_text_spec.rb
         | 
| 111 | 
            +
            - spec/lib/rambling/trie/serializers/file_spec.rb
         | 
| 112 | 
            +
            - spec/lib/rambling/trie/serializers/marshal_spec.rb
         | 
| 113 | 
            +
            - spec/lib/rambling/trie/serializers/yaml_spec.rb
         | 
| 114 | 
            +
            - spec/lib/rambling/trie/serializers/zip_spec.rb
         | 
| 115 | 
            +
            - spec/lib/rambling/trie/stringifyable_spec.rb
         | 
| 109 116 | 
             
            - spec/lib/rambling/trie_spec.rb
         | 
| 110 117 | 
             
            - spec/spec_helper.rb
         | 
| 118 | 
            +
            - spec/support/config.rb
         | 
| 119 | 
            +
            - spec/support/shared_examples/a_compressable_trie.rb
         | 
| 120 | 
            +
            - spec/support/shared_examples/a_serializable_trie.rb
         | 
| 121 | 
            +
            - spec/support/shared_examples/a_serializer.rb
         | 
| 122 | 
            +
            - spec/support/shared_examples/a_trie_data_structure.rb
         | 
| 123 | 
            +
            - spec/tmp/.gitkeep
         | 
| 111 124 | 
             
            homepage: http://github.com/gonzedge/rambling-trie
         | 
| 112 125 | 
             
            licenses:
         | 
| 113 126 | 
             
            - MIT
         | 
| @@ -131,18 +144,32 @@ rubyforge_project: | |
| 131 144 | 
             
            rubygems_version: 2.6.8
         | 
| 132 145 | 
             
            signing_key: 
         | 
| 133 146 | 
             
            specification_version: 4
         | 
| 134 | 
            -
            summary: A  | 
| 147 | 
            +
            summary: A Ruby implementation of the trie data structure.
         | 
| 135 148 | 
             
            test_files:
         | 
| 136 149 | 
             
            - spec/assets/test_words.en_US.txt
         | 
| 137 150 | 
             
            - spec/assets/test_words.es_DO.txt
         | 
| 138 151 | 
             
            - spec/integration/rambling/trie_spec.rb
         | 
| 152 | 
            +
            - spec/lib/rambling/trie/comparable_spec.rb
         | 
| 139 153 | 
             
            - spec/lib/rambling/trie/compressed_node_spec.rb
         | 
| 140 154 | 
             
            - spec/lib/rambling/trie/compressor_spec.rb
         | 
| 155 | 
            +
            - spec/lib/rambling/trie/configuration/properties_spec.rb
         | 
| 156 | 
            +
            - spec/lib/rambling/trie/configuration/provider_collection_spec.rb
         | 
| 141 157 | 
             
            - spec/lib/rambling/trie/container_spec.rb
         | 
| 142 158 | 
             
            - spec/lib/rambling/trie/enumerable_spec.rb
         | 
| 143 | 
            -
            - spec/lib/rambling/trie/ | 
| 159 | 
            +
            - spec/lib/rambling/trie/inspectable_spec.rb
         | 
| 144 160 | 
             
            - spec/lib/rambling/trie/node_spec.rb
         | 
| 145 | 
            -
            - spec/lib/rambling/trie/plain_text_reader_spec.rb
         | 
| 146 161 | 
             
            - spec/lib/rambling/trie/raw_node_spec.rb
         | 
| 162 | 
            +
            - spec/lib/rambling/trie/readers/plain_text_spec.rb
         | 
| 163 | 
            +
            - spec/lib/rambling/trie/serializers/file_spec.rb
         | 
| 164 | 
            +
            - spec/lib/rambling/trie/serializers/marshal_spec.rb
         | 
| 165 | 
            +
            - spec/lib/rambling/trie/serializers/yaml_spec.rb
         | 
| 166 | 
            +
            - spec/lib/rambling/trie/serializers/zip_spec.rb
         | 
| 167 | 
            +
            - spec/lib/rambling/trie/stringifyable_spec.rb
         | 
| 147 168 | 
             
            - spec/lib/rambling/trie_spec.rb
         | 
| 148 169 | 
             
            - spec/spec_helper.rb
         | 
| 170 | 
            +
            - spec/support/config.rb
         | 
| 171 | 
            +
            - spec/support/shared_examples/a_compressable_trie.rb
         | 
| 172 | 
            +
            - spec/support/shared_examples/a_serializable_trie.rb
         | 
| 173 | 
            +
            - spec/support/shared_examples/a_serializer.rb
         | 
| 174 | 
            +
            - spec/support/shared_examples/a_trie_data_structure.rb
         | 
| 175 | 
            +
            - spec/tmp/.gitkeep
         | 
| @@ -1,13 +0,0 @@ | |
| 1 | 
            -
            module Rambling
         | 
| 2 | 
            -
              module Trie
         | 
| 3 | 
            -
                # Provides the compressing behavior for the Trie data structure.
         | 
| 4 | 
            -
                module Compression
         | 
| 5 | 
            -
                  # Indicates if the current [Rambling::Trie::Node] can be compressed.
         | 
| 6 | 
            -
                  # @return [Boolean] `true` for non-terminal nodes with one child,
         | 
| 7 | 
            -
                  # `false` otherwise.
         | 
| 8 | 
            -
                  def compressable?
         | 
| 9 | 
            -
                    !(root? || terminal?) && children_tree.size == 1
         | 
| 10 | 
            -
                  end
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
              end
         | 
| 13 | 
            -
            end
         |