regexp_trie 0.1.0 → 0.2.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/CHANGES.md +9 -0
- data/README.md +14 -3
- data/example/synopsis.rb +10 -3
- data/lib/regexp_trie/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01582ccdb8d800cc4fb4ddcc6e31d333a4078c33
|
4
|
+
data.tar.gz: 176d5895f95dba8a666e0752766fb4a380062304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e291c4c4384a5a12d2e0d5b8f112dac8fdc97dc9a76e9386be2dbec5f39ed6438fa8479cfc65cfdaa585425b5b772f2e4499d5aa46ea49a4a6f7541dd6bde3
|
7
|
+
data.tar.gz: f7b71a7c335df3f54d316d7a9afd34022b6081ab6a9207948ec0a7db697bcce9ba7e87a086387cf1d62d13b7933225ee4591d086dd6ad91ad195dd7789059a69
|
data/CHANGES.md
ADDED
data/README.md
CHANGED
@@ -3,10 +3,17 @@
|
|
3
3
|
## Synopsis
|
4
4
|
|
5
5
|
```ruby
|
6
|
+
#!/usr/bin/env ruby
|
6
7
|
require 'regexp_trie'
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
# like Regexp.union()
|
9
|
+
p RegexpTrie.union(%w(foobar fooxar foozap fooza)) # (?-mix:foo(?:bar|xar|zap?))
|
10
|
+
|
11
|
+
# or object-oriented interface
|
12
|
+
rt = RegexpTrie.new
|
13
|
+
%w(foobar fooxar foozap fooza).each do |word|
|
14
|
+
rt.add(word)
|
15
|
+
end
|
16
|
+
p rt.to_regexp # (?-mix:foo(?:bar|xar|zap?))
|
10
17
|
```
|
11
18
|
|
12
19
|
See also the original [Regexp::Trie in Perl](https://metacpan.org/pod/Regexp::Trie).
|
@@ -25,6 +32,10 @@ Add this line to your application's Gemfile:
|
|
25
32
|
gem 'regexp_trie'
|
26
33
|
```
|
27
34
|
|
35
|
+
## Known Issues
|
36
|
+
|
37
|
+
This is not perfectly compatible with `Regexp.union()`.
|
38
|
+
|
28
39
|
## Development
|
29
40
|
|
30
41
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/example/synopsis.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
require 'regexp_trie'
|
2
|
-
|
3
|
-
|
4
|
-
|
3
|
+
# like Regexp.union()
|
4
|
+
p RegexpTrie.union(%w(foobar fooxar foozap fooza)) # /foo(?:bar|xar|zap?)/
|
5
|
+
|
6
|
+
# or object-oriented interface
|
7
|
+
rt = RegexpTrie.new
|
8
|
+
%w(foobar fooxar foozap fooza).each do |word|
|
9
|
+
rt.add(word)
|
10
|
+
end
|
11
|
+
p rt.to_regexp # /foo(?:bar|xar|zap?)/
|
data/lib/regexp_trie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regexp_trie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FUJI Goro (gfx)
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".travis.yml"
|
78
|
+
- CHANGES.md
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|