dynamic_parser 0.0.0.pre.5 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Readme.md +8 -8
- data/dynamic_parser.gemspec +6 -7
- data/lib/dynamic_parser/micro_parsers/stateless.rb +1 -1
- data/lib/dynamic_parser/regex_cache.rb +2 -2
- data/lib/dynamic_parser/version.rb +3 -3
- data/spec/dynamic_parser/regex_cache_spec.rb +21 -26
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbfedb848686f4f562e61c07da9dad79c239b868
|
4
|
+
data.tar.gz: 0402c680291d46d5764ed151d9c22da1d7e6a354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb280d39cbed4504c6ca0db4ce38bdedc1abde19547dc0ca3fbb2d0c5292fa1407dd651abceadbee95b796c24b4043735382ae19fa786be8b5147a23536c85a7
|
7
|
+
data.tar.gz: c4cf58bdbc0edc02c0287191b221f645c5412b17281b130152ce72b296225574b87d2c28941368ef40791dcd6a31371323e84481b53bdfa8957006bf8be6e30d
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.5
|
data/Readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Code Climate](https://codeclimate.com/github/lucasmartins/dynamic_parser.png)](https://codeclimate.com/github/lucasmartins/dynamic_parser) [![Code Climate](https://codeclimate.com/github/lucasmartins/dynamic_parser/coverage.png)](https://codeclimate.com/github/lucasmartins/dynamic_parser) [ ![Codeship Status for
|
1
|
+
[![Code Climate](https://codeclimate.com/github/lucasmartins/dynamic_parser.png)](https://codeclimate.com/github/lucasmartins/dynamic_parser) [![Code Climate](https://codeclimate.com/github/lucasmartins/dynamic_parser/coverage.png)](https://codeclimate.com/github/lucasmartins/dynamic_parser) [ ![Codeship Status for ContaBoa/dynamic_parser](https://codeship.io/projects/dee1ef60-da1c-0131-2e3f-2a27b6732ed0/status)](https://codeship.io/projects/24259)
|
2
2
|
|
3
3
|
Dynamic Parser
|
4
4
|
==============
|
@@ -10,7 +10,7 @@ Install
|
|
10
10
|
|
11
11
|
Just add it to your Gemfile - not really
|
12
12
|
```ruby
|
13
|
-
gem 'dynamic_parser', github: '
|
13
|
+
gem 'dynamic_parser', github: 'ContaBoa/dynamic_parser'
|
14
14
|
```
|
15
15
|
|
16
16
|
Use
|
@@ -26,7 +26,7 @@ The following samples will expect a text/String as the received artifact to be p
|
|
26
26
|
# parses the artifact statically
|
27
27
|
class StatelessParser
|
28
28
|
include DynamicParser::MicroParser::Stateless
|
29
|
-
|
29
|
+
|
30
30
|
def self.detect(txt)
|
31
31
|
txt.include?('static')
|
32
32
|
end
|
@@ -49,7 +49,7 @@ class StatefulParser
|
|
49
49
|
def initialize
|
50
50
|
@data = []
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def detect(txt)
|
54
54
|
self.class.detect(txt)
|
55
55
|
end
|
@@ -101,7 +101,7 @@ end
|
|
101
101
|
|
102
102
|
Docs
|
103
103
|
====
|
104
|
-
You should check the [factories](https://github.com/
|
104
|
+
You should check the [factories](https://github.com/ContaBoa/dynamic_parser/tree/master/spec/factories) to learn what you need to build your objects, and the [tests](https://github.com/ContaBoa/dynamic_parser/tree/master/spec/DynamicParser) to learn how to use them. But hey, we have docs [right here](http://rdoc.info/github/ContaBoa/dynamic_parser/master/frames).
|
105
105
|
|
106
106
|
Roadmap
|
107
107
|
=======
|
@@ -111,9 +111,9 @@ Roadmap
|
|
111
111
|
Contribute
|
112
112
|
==========
|
113
113
|
|
114
|
-
Just fork [DynamicParser](https://github.com/
|
115
|
-
|
114
|
+
Just fork [DynamicParser](https://github.com/ContaBoa/dynamic_parser), add your feature+spec, and make a pull request.
|
115
|
+
|
116
116
|
License
|
117
117
|
=======
|
118
118
|
|
119
|
-
Please see [LICENSE](https://github.com/
|
119
|
+
Please see [LICENSE](https://github.com/ContaBoa/dynamic_parser/blob/master/LICENSE) for licensing details.
|
data/dynamic_parser.gemspec
CHANGED
@@ -8,17 +8,17 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.required_ruby_version = ">= 2.1.0"
|
10
10
|
s.authors = ["Lucas Martins"]
|
11
|
-
s.email = ["
|
12
|
-
s.homepage = "https://github.com/
|
13
|
-
s.summary = "An interchangeble parser builder for Ruby"
|
14
|
-
s.description =
|
15
|
-
s.license = "
|
11
|
+
s.email = ["lucas@contaboa.com.br"]
|
12
|
+
s.homepage = "https://github.com/ContaBoa/dynamic_parser"
|
13
|
+
s.summary = "An interchangeble, compositable parser builder for Ruby"
|
14
|
+
s.description = "Your Dynamic Parser may be a composite of both `Stateless` and `Stateful` parsers. To build a composite/dynamic paser, first you need one or more `MicroParsers`.\nCheck https://github.com/ContaBoa/dynamic_parser for more details."
|
15
|
+
s.license = "LGPL-3.0"
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
#s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
-
|
21
|
+
|
22
22
|
if RUBY_ENGINE=='rbx'
|
23
23
|
s.add_dependency 'rubysl'
|
24
24
|
end
|
@@ -32,4 +32,3 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_development_dependency "pry-nav", '0.2.3'
|
33
33
|
s.add_development_dependency "yard", '0.8.7.3'
|
34
34
|
end
|
35
|
-
|
@@ -18,7 +18,7 @@ module DynamicParser::RegexCache
|
|
18
18
|
block.call
|
19
19
|
end
|
20
20
|
else
|
21
|
-
puts "[DynamicParser] No known driver available for caching!"
|
21
|
+
puts "[DynamicParser] No known driver available for caching! Using memory."
|
22
22
|
@cache ||= block.call
|
23
23
|
end
|
24
24
|
end
|
@@ -26,4 +26,4 @@ module DynamicParser::RegexCache
|
|
26
26
|
def self.digest(s)
|
27
27
|
Digest::MD5.hexdigest(s)
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
@@ -1,17 +1,9 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe DynamicParser::RegexCache do
|
4
|
-
|
5
|
-
describe '.match' do
|
6
|
-
it 'runs without a cache driver' do
|
7
|
-
expect do
|
8
|
-
DynamicParser::RegexCache.match(/txt/,'txt') do |matched|
|
9
|
-
matched.to_s
|
10
|
-
end
|
11
|
-
end.not_to raise_error
|
12
|
-
end
|
13
4
|
|
14
|
-
|
5
|
+
describe '.match' do
|
6
|
+
it 'returns the expected content' do
|
15
7
|
expect(
|
16
8
|
DynamicParser::RegexCache.match(/txt/,'some txt content') do |matched|
|
17
9
|
matched.to_s
|
@@ -19,25 +11,28 @@ describe DynamicParser::RegexCache do
|
|
19
11
|
).to eq('txt')
|
20
12
|
end
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
if defined?(Rails) && Rails.respond_to?(:cache)
|
15
|
+
it 'caches the expected content' do
|
16
|
+
class Dummy
|
17
|
+
def self.call
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
Dummy.should_receive(:call).once
|
22
|
+
DynamicParser::RegexCache.match(/txt/,'some txt content') do |matched|
|
23
|
+
Dummy.call
|
24
|
+
matched.to_s
|
26
25
|
end
|
27
|
-
end
|
28
|
-
Dummy.should_receive(:call).once
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
DynamicParser::RegexCache.match(/txt/,'some txt content') do |matched|
|
36
|
-
Dummy.call
|
37
|
-
matched.to_s
|
27
|
+
DynamicParser::RegexCache.match(/txt/,'some txt content') do |matched|
|
28
|
+
Dummy.call
|
29
|
+
matched.to_s
|
30
|
+
end
|
38
31
|
end
|
39
|
-
|
32
|
+
else
|
33
|
+
puts "There's no supported cache driver on this environment, skipping the test."
|
40
34
|
end
|
35
|
+
|
41
36
|
end
|
42
37
|
|
43
|
-
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Martins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -122,9 +122,11 @@ dependencies:
|
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.8.7.3
|
125
|
-
description:
|
125
|
+
description: |-
|
126
|
+
Your Dynamic Parser may be a composite of both `Stateless` and `Stateful` parsers. To build a composite/dynamic paser, first you need one or more `MicroParsers`.
|
127
|
+
Check https://github.com/ContaBoa/dynamic_parser for more details.
|
126
128
|
email:
|
127
|
-
-
|
129
|
+
- lucas@contaboa.com.br
|
128
130
|
executables: []
|
129
131
|
extensions: []
|
130
132
|
extra_rdoc_files: []
|
@@ -156,9 +158,9 @@ files:
|
|
156
158
|
- spec/support/stateful_parser.rb
|
157
159
|
- spec/support/stateless_parser.rb
|
158
160
|
- tmp/.keep
|
159
|
-
homepage: https://github.com/
|
161
|
+
homepage: https://github.com/ContaBoa/dynamic_parser
|
160
162
|
licenses:
|
161
|
-
-
|
163
|
+
- LGPL-3.0
|
162
164
|
metadata: {}
|
163
165
|
post_install_message:
|
164
166
|
rdoc_options: []
|
@@ -171,15 +173,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
173
|
version: 2.1.0
|
172
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
175
|
requirements:
|
174
|
-
- - "
|
176
|
+
- - ">="
|
175
177
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
178
|
+
version: '0'
|
177
179
|
requirements: []
|
178
180
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.6.4
|
180
182
|
signing_key:
|
181
183
|
specification_version: 4
|
182
|
-
summary: An interchangeble parser builder for Ruby
|
184
|
+
summary: An interchangeble, compositable parser builder for Ruby
|
183
185
|
test_files:
|
184
186
|
- spec/dynamic_parser/composite_parser_spec.rb
|
185
187
|
- spec/dynamic_parser/dynamic_parser_spec.rb
|