aranha-parsers 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 990eaaf39db15ed3c74d22039dd4c10ef005a5f46d8e6325087a7517f9795ae9
4
- data.tar.gz: 895b5ab2673ff4663576e6a41bfaba3fe96d324df59617e8cfc4f9f116929af2
3
+ metadata.gz: b28eaf4a05a75966ce8828c5dcf3f86d885653e8b8abd815bba944371b9bcebc
4
+ data.tar.gz: '08f37d7c3a325af408368c338a386ca8f244a4ce36702e172f49b11e8b653256'
5
5
  SHA512:
6
- metadata.gz: 1387956a1035e8984ec724ddff13933b567ca1a8155eec4b7d61c52374d0d9ec398966e146bb46356d57b68cab5926e4ce7a610aed52dac77f5a87eeba5b0d55
7
- data.tar.gz: 34f475e75e54677aad15a5650f112acf72a16e50dc4729e8226705181c82d4dc813cc8dbf79493d0a184f4039d947a943cc91bd62e830f797153021194809594
6
+ metadata.gz: 8b7c286fea023c0f148c7a56931fa844555008edb1767ee3e8d3912969561257aba285cd67921282e4c3d9dd9155e27f6f4aa2fd61e5ed8030cd2b8c23e5f103
7
+ data.tar.gz: b616cb0faf36dfff89f615c123a4f4ddfaf45b42a0302473f92fbb893d282bf4cf958cb46b1047608d5cf58a70723485e00f2fd8601d2843e4a206e0dadbf143
@@ -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
- s = source_address.content
23
- log_content(s)
24
- s
38
+ @content ||= begin
39
+ s = source_address.content
40
+ log_content(s)
41
+ s
42
+ end
25
43
  end
26
44
 
27
45
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Parsers
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
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.5.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-05-29 00:00:00.000000000 Z
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
- rubyforge_project:
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.