aranha-parsers 0.5.0 → 0.6.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/lib/aranha/parsers/base.rb +21 -3
- data/lib/aranha/parsers/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b28eaf4a05a75966ce8828c5dcf3f86d885653e8b8abd815bba944371b9bcebc
|
4
|
+
data.tar.gz: '08f37d7c3a325af408368c338a386ca8f244a4ce36702e172f49b11e8b653256'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b7c286fea023c0f148c7a56931fa844555008edb1767ee3e8d3912969561257aba285cd67921282e4c3d9dd9155e27f6f4aa2fd61e5ed8030cd2b8c23e5f103
|
7
|
+
data.tar.gz: b616cb0faf36dfff89f615c123a4f4ddfaf45b42a0302473f92fbb893d282bf4cf958cb46b1047608d5cf58a70723485e00f2fd8601d2843e4a206e0dadbf143
|
data/lib/aranha/parsers/base.rb
CHANGED
@@ -3,10 +3,26 @@
|
|
3
3
|
require 'open-uri'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'aranha/parsers/source_address'
|
6
|
+
require 'eac_ruby_utils/fs/temp'
|
6
7
|
|
7
8
|
module Aranha
|
8
9
|
module Parsers
|
9
10
|
class Base
|
11
|
+
class << self
|
12
|
+
def from_content(content)
|
13
|
+
::EacRubyUtils::Fs::Temp.on_file do |path|
|
14
|
+
path.write(content)
|
15
|
+
r = new(path.to_path)
|
16
|
+
r.content
|
17
|
+
r
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse_content(content)
|
22
|
+
from_content(content).data
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
10
26
|
LOG_DIR_ENVVAR = 'ARANHA_PARSERS_LOG_DIR'
|
11
27
|
|
12
28
|
attr_reader :source_address
|
@@ -19,9 +35,11 @@ module Aranha
|
|
19
35
|
delegate :url, to: :source_address
|
20
36
|
|
21
37
|
def content
|
22
|
-
|
23
|
-
|
24
|
-
|
38
|
+
@content ||= begin
|
39
|
+
s = source_address.content
|
40
|
+
log_content(s)
|
41
|
+
s
|
42
|
+
end
|
25
43
|
end
|
26
44
|
|
27
45
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranha-parsers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -165,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
|
-
|
169
|
-
rubygems_version: 2.7.7
|
168
|
+
rubygems_version: 3.0.8
|
170
169
|
signing_key:
|
171
170
|
specification_version: 4
|
172
171
|
summary: Parsers' utilities for Ruby.
|