aranha-parsers 0.19.1 → 0.20.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: 91372566e26e02c7b89046685db76a3515f8c4c18538d36286487553cd65143b
4
- data.tar.gz: 9a61d35795038c070daba3121b7c3036bf9bd561599f782c19d45d6147649476
3
+ metadata.gz: fa915be6016406435fb47dc3eecb8901579b8c6d5b32b72a4e90b546f9213ad0
4
+ data.tar.gz: 30ad5a0bd9abaf92282de9441feb949f0d83f32293cb11040f197c89246f37d4
5
5
  SHA512:
6
- metadata.gz: 4a1731885fd90ce6baf5ca267cac8c7e3bc134de828f948a89ff24ba338d275920a65db1727ae9f7e3bfda87a1fcda82ca64c1e2e2ec67fc8c0791268935cb13
7
- data.tar.gz: 5d2c8bfd3908f7a3d103ec417376db4d85e1e84993130bff11a8d2c46cb13dab205d0020090e132450652d370fb064c770d081c5f4391fed5377297c3a1a43bd
6
+ metadata.gz: 4d6c8edf3a17ceec908482b6dd9ecce69a35ab6b178e5daf44c7f55a0b3cfe2ed326ad275f02d7856a36b881e7a5261a7575fe7f1972842854b1c2c2e20b1490
7
+ data.tar.gz: aa3804298dbc0540306cccc4f9546392092de04d052ab7af9c4dac17b3bc126735ae6ec79c1f9fdc062b6003a35975f71c7acb773a3aac3f79a6df01f9e50d9b
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/node/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Aranha
7
+ module Parsers
8
+ module Html
9
+ module Node
10
+ class Default < ::Aranha::Parsers::Html::Node::Base
11
+ module MiscellaneousSupport
12
+ # @param node [Nokogiri::XML::Node]
13
+ # @param xpath [String]
14
+ # @return [Boolean]
15
+ def boolean_value(node, xpath)
16
+ node_value(node, xpath).to_bool
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/node/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Aranha
7
+ module Parsers
8
+ module Html
9
+ module Node
10
+ class Default < ::Aranha::Parsers::Html::Node::Base
11
+ module NodesSupport
12
+ # @param node [Nokogiri::XML::Node]
13
+ # @param xpath [String]
14
+ # @return [Nokogiri::XML::NodeSet]
15
+ def node_set_value(node, xpath)
16
+ node.xpath(xpath)
17
+ end
18
+
19
+ # @param node [Nokogiri::XML::Node]
20
+ # @param xpath [String]
21
+ # @return [Nokogiri::XML::Node]
22
+ def node_value(node, xpath)
23
+ node.at_xpath(xpath)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -10,31 +10,11 @@ module Aranha
10
10
  class Default < ::Aranha::Parsers::Html::Node::Base
11
11
  require_sub __FILE__, include_modules: true
12
12
 
13
- def join_value(node, xpath)
14
- m = ''
15
- node_set_value(node, xpath).each do |n|
16
- m << n.text.strip
17
- end
18
- m
19
- end
20
-
21
- def duration_value(node, xpath)
22
- m = /(\d+) m/.match(join_value(node, xpath))
23
- m ? m[1].to_i : nil
24
- end
25
-
26
- # @param node [Nokogiri::XML::Node]
27
- # @param xpath [String]
28
- # @return [Nokogiri::XML::NodeSet]
29
- def node_set_value(node, xpath)
30
- node.xpath(xpath)
31
- end
32
-
33
13
  # @param node [Nokogiri::XML::Node]
34
14
  # @param xpath [String]
35
- # @return [Nokogiri::XML::Node]
36
- def node_value(node, xpath)
37
- node.at_xpath(xpath)
15
+ # @return [Boolean]
16
+ def boolean_value(node, xpath)
17
+ node_value(node, xpath).to_bool
38
18
  end
39
19
  end
40
20
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Parsers
5
- VERSION = '0.19.1'
5
+ VERSION = '0.20.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.19.1
4
+ version: 0.20.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: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2023-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -147,6 +147,8 @@ files:
147
147
  - lib/aranha/parsers/html/node.rb
148
148
  - lib/aranha/parsers/html/node/base.rb
149
149
  - lib/aranha/parsers/html/node/default.rb
150
+ - lib/aranha/parsers/html/node/default/miscellaneous_support.rb
151
+ - lib/aranha/parsers/html/node/default/nodes_support.rb
150
152
  - lib/aranha/parsers/html/node/default/numeric_support.rb
151
153
  - lib/aranha/parsers/html/node/default/string_support.rb
152
154
  - lib/aranha/parsers/invalid_state_exception.rb