teodoro 0.0.1

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.
@@ -0,0 +1,31 @@
1
+ module Teodoro
2
+ class XML
3
+ private
4
+
5
+ def initialize(xml)
6
+ @xml = xml
7
+ end
8
+
9
+ attr_reader :xml
10
+
11
+ public
12
+
13
+ def [](*path)
14
+ node_set = xml.css("*/#{path.join('/')}")
15
+
16
+ raise if node_set.size > 1
17
+ return if node_set.size.zero?
18
+
19
+ node = node_set[0]
20
+ if node.css('*').empty?
21
+ node_set.text
22
+ else
23
+ self.class.new(Nokogiri::XML(node.to_s))
24
+ end
25
+ end
26
+
27
+ def *(path) # rubocop:disable Naming/BinaryOperatorParameterName
28
+ xml.css("*/#{path}").map { |node| self.class.new(Nokogiri::XML(node.to_s)) }
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teodoro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Clavius Tales
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables:
16
+ - teodoro
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/teodoro
21
+ - lib/teodoro.rb
22
+ - lib/teodoro/arquivo_de_evento.rb
23
+ - lib/teodoro/arquivo_de_evento_de_tabela.rb
24
+ - lib/teodoro/arquivo_de_evento_nao_periodico.rb
25
+ - lib/teodoro/arquivo_de_origem.rb
26
+ - lib/teodoro/arquivo_xml.rb
27
+ - lib/teodoro/cnpj.rb
28
+ - lib/teodoro/console.rb
29
+ - lib/teodoro/empresa.rb
30
+ - lib/teodoro/execucao.rb
31
+ - lib/teodoro/leiaute_2_4_1.rb
32
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1000.rb
33
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1005.rb
34
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1010.rb
35
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1020.rb
36
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1030.rb
37
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1040.rb
38
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1050.rb
39
+ - lib/teodoro/leiaute_2_4_1/arquivo_s1070.rb
40
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2190.rb
41
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2200.rb
42
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2205.rb
43
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2206.rb
44
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2230.rb
45
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2250.rb
46
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2300.rb
47
+ - lib/teodoro/leiaute_2_4_1/arquivo_s2306.rb
48
+ - lib/teodoro/xml.rb
49
+ homepage:
50
+ licenses: []
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.2.15
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: ''
71
+ test_files: []