text_extractor 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/text_extractor/filldown.rb +11 -1
- data/lib/text_extractor/value.rb +5 -1
- data/lib/text_extractor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78291099c84221f93ff6068099d736bc6703579b
|
4
|
+
data.tar.gz: 8a65b9164e395200fac46207b6b313dfa8084a2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b18d39bde364c3417ccd18ff4ce8f072568e3e63b838b1bdce46b25cffd6b7356dbf2f4e9b1f6fd816368ce0aa194a1e6cc9f4ccd584f579a85eb795b264ddd
|
7
|
+
data.tar.gz: a99721d0d2a48b5364dd301415334fdd85563664144d3d4a216c70d2c39ecd7654b64b9e49c78f582bb762c4dae8d33abc809b45807328f35b010fc3aff31482
|
@@ -2,9 +2,19 @@ require_relative 'record'
|
|
2
2
|
|
3
3
|
class TextExtractor
|
4
4
|
class Filldown < Record
|
5
|
+
def initialize(*args, **kwargs)
|
6
|
+
@filldown_output = kwargs.delete(:output) || false
|
7
|
+
super(*args, **kwargs)
|
8
|
+
end
|
9
|
+
|
5
10
|
def extraction(match, fill)
|
6
11
|
fill.merge!(extract_values(match))
|
7
|
-
|
12
|
+
|
13
|
+
if @filldown_output
|
14
|
+
super
|
15
|
+
else
|
16
|
+
[]
|
17
|
+
end
|
8
18
|
end
|
9
19
|
end # class Filldown < Record
|
10
20
|
end # class TextExtractor
|
data/lib/text_extractor/value.rb
CHANGED
@@ -9,7 +9,11 @@ class TextExtractor
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def convert(value)
|
12
|
-
@block ? @block.call(
|
12
|
+
@block ? @block.call(value) : value
|
13
|
+
rescue => e
|
14
|
+
raise e.class,
|
15
|
+
"in custom conversion of "\
|
16
|
+
"value(#{id.inspect}, #{re.inspect}): #{e.message}"
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|