free_dom 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2955fd654294f2fd1eb821d23dfcda69a78caa02176ca5d32663383b25ad9c1a
4
+ data.tar.gz: 4aaa3a36bfb059c1e77fc9d86c06513d10b67d6283dc8157c720168fe6ab5605
5
+ SHA512:
6
+ metadata.gz: 18c25f4563a48e85a570328e5e8147958eef9634a8d3f7465b6eabd709e77bfd49be1668013e1608a01326c9fa0c9c539f5668cd88b2b47cff8ac4285e088e41
7
+ data.tar.gz: 25d1f4e5cde908569da5d20214495c8580a919ce2d22f0b9726fe00ec4efad7f87e57abd91f88b5726f6e891a97d6d8804129c2c05bd835fedd9174d43433b30
Binary file
Binary file
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: free_dom.rb
4
+
5
+ require 'domle'
6
+
7
+
8
+ class FreeDom < Domle
9
+
10
+ def initialize(xml)
11
+
12
+ doc = Rexle.new xml
13
+
14
+ h = {}
15
+
16
+ doc.root.each_recursive do |e|
17
+ h[e.name.to_sym] ||= {}
18
+ h[e.name.to_sym].merge!(e.attributes)
19
+ end
20
+
21
+ @defined_elements = {}
22
+
23
+ h.each do |name, attributes|
24
+
25
+ klass = Class.new(Domle::Element) do
26
+
27
+ attr2_accessor *attributes.keys
28
+
29
+ end
30
+
31
+ custom_class = FreeDom.const_set name.to_s.capitalize, klass
32
+ @defined_elements.merge!({name => custom_class})
33
+
34
+ end
35
+
36
+ super(xml)
37
+ end
38
+
39
+ private
40
+
41
+ def defined_elements()
42
+ @defined_elements
43
+ end
44
+
45
+ end
46
+
47
+
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: free_dom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ aut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1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAcIlboY8Gudv/UW9j4CvT0bXK3lJ/qg/nnE0vqiKP
29
+ +ror3CE2vG0bN5J1ia7VZgepPMt55f4eMfFdYKcCzE+YM9RaSa35qnfSPUR1omNs
30
+ /Jl8KmKdgHiCvcFI0+Q7kSX1xrNgdcEaUcutvHgY4Wg5hW04cC2QPRI5PEjl5Q/4
31
+ HzUsuWKv8oP3ulRUg2z97x4TVyewO7HJ9n0swcim4uieLQHc/t/VL8KQ8Ynx1T2M
32
+ 5+McK4ekR1ed0QY8vM/zp4hsvKByre05f2XVRxe37YjPpS9xP+JGfoKU8KG+mlWt
33
+ L6oTXKicNcV/O9GCnVPArudFdeOAAvEGI2izAUI42nMPpu7rgNEPzjrLIQ4qsMFJ
34
+ 4DK35MuFK8T+fQUKswdRSdOTJsKbggzHYbZMoMiKPui5jjoucWoWhGc+jZg9SdO7
35
+ VxSuuHhAXplX7wWmd1FzAAH5bk4OPlKGt5fxQbax+FSoEzTsnoDcLTY2i0WOxwRo
36
+ 76nAi+UZoU87S6brj88/rtOL
37
+ -----END CERTIFICATE-----
38
+ date: 2020-04-29 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: domle
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.3.1
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.3'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.1
60
+ description:
61
+ email: james@jamesrobertson.eu
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/free_dom.rb
67
+ homepage: https://github.com/jrobertson/free_dom
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.0.3
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Dynamically builds a DOM from XML.
90
+ test_files: []
Binary file