array_trie 0.1.1 → 0.1.2
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/README.md +8 -7
- data/array_trie.gemspec +2 -1
- data/bin/console +2 -5
- data/lib/array_trie/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8dbfc9bc8ef73ed3cd47aa2feee35ca5b8b9e3c
|
4
|
+
data.tar.gz: 5ad90e8b9ec083ac0fd0f45456becc7a06ef45cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87135d9e0a3e8c5ebc2d8c2a551bb587585f11f679c9321ced3a4f55c05630606a7b635ad9534cd54f535d6983a98e74ca54be9387cfb65256d7be1ec8d8b670
|
7
|
+
data.tar.gz: 61f33cd1e4d74e03fd072dc4e15ca2f4e3b6cf1e0999fceb603dba1f8a1feda4e7340a1b95488d6efe396cddd2406bd5246a308cc254bf62cdc5473950a2118c
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# ArrayTrie
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/array_trie)
|
4
|
-
[API docs](
|
4
|
+
[API docs](http://www.rubydoc.info/gems/array_trie)
|
5
5
|
|
6
6
|
Trie-like, prefix-tree data structures. First, a prefix-tree based on Arrays, which differs from a traditional trie, which maps strings to values. Second, a more general prefix-tree data structure that works for any type of keys, provided those keys can be transformed to and from an array.
|
7
7
|
|
@@ -52,11 +52,11 @@ paths.count_prefix('/usr/local')
|
|
52
52
|
# You can obtain a subtrie to operate on a subsection of your trie
|
53
53
|
usr_local = paths.subtrie('/usr/local')
|
54
54
|
usr_local['bin/ruby']
|
55
|
-
# =>
|
55
|
+
# => "executable"
|
56
56
|
|
57
57
|
usr_local['bin/fish'] = 'executable'
|
58
58
|
paths['/usr/local/bin/fish']
|
59
|
-
# => executable
|
59
|
+
# => "executable"
|
60
60
|
|
61
61
|
# Use #breadth_first and #depth_first to enumarate your keys and values
|
62
62
|
paths.breadth_first do |k, v|
|
@@ -69,10 +69,11 @@ end
|
|
69
69
|
# These methods return Enumerators, so you can use them with #map, etc.
|
70
70
|
enum = paths.depth_first
|
71
71
|
as_hash = Hash[enum.to_a]
|
72
|
-
# =>
|
73
|
-
# "/usr/local/bin/ruby"=>"executable",
|
74
|
-
# "/usr/local/etc/nginx/nginx.cfg"=>"config file",
|
75
|
-
# "/bin/bash"=>"executable"
|
72
|
+
# => {
|
73
|
+
# ... "/usr/local/bin/ruby"=>"executable",
|
74
|
+
# ... "/usr/local/etc/nginx/nginx.cfg"=>"config file",
|
75
|
+
# ... "/bin/bash"=>"executable"
|
76
|
+
# ... }
|
76
77
|
```
|
77
78
|
|
78
79
|
## Development
|
data/array_trie.gemspec
CHANGED
@@ -17,7 +17,7 @@ Trie-like, prefix-tree data structures. First, a prefix-tree based on Arrays, wh
|
|
17
17
|
|
18
18
|
Both of these data structures are implemented in terms of hashes.
|
19
19
|
EOS
|
20
|
-
spec.homepage = "https://github.com/justjake/array-trie"
|
20
|
+
spec.homepage = "https://github.com/justjake/ruby-array-trie"
|
21
21
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
23
|
f.match(%r{^(test|spec|features)/})
|
@@ -29,4 +29,5 @@ Both of these data structures are implemented in terms of hashes.
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.15"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.7"
|
32
|
+
spec.add_development_dependency "pry"
|
32
33
|
end
|
data/bin/console
CHANGED
@@ -7,8 +7,5 @@ require "array_trie"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
data/lib/array_trie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: array_trie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Teton-Landis
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: |
|
56
70
|
Trie-like, prefix-tree data structures. First, a prefix-tree based on Arrays, which differs from a traditional trie, which maps strings to values. Second, a more general prefix-tree data structure that works for any type of keys, provided those keys can be transformed to and from an array.
|
57
71
|
|
@@ -74,7 +88,7 @@ files:
|
|
74
88
|
- lib/array_trie.rb
|
75
89
|
- lib/array_trie/prefix_trie.rb
|
76
90
|
- lib/array_trie/version.rb
|
77
|
-
homepage: https://github.com/justjake/array-trie
|
91
|
+
homepage: https://github.com/justjake/ruby-array-trie
|
78
92
|
licenses: []
|
79
93
|
metadata: {}
|
80
94
|
post_install_message:
|