xmlregistry_objects 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/xmlregistry_objects.rb +49 -39
- data.tar.gz.sig +0 -0
- metadata +36 -33
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cc95b8fd15a36a13fc93bd48f1bc0840cfadd1ff5cc9f0735e6bd65b2bc94ec6
|
4
|
+
data.tar.gz: 2bffbe5094f477efaf7a67eb734ad16f9a46314eeac3b3c85ac63a98e95dc8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 546866da99885b618030623ea8c5069cdabc2a24fd2ab5fd549eabbbd34d4a53b6898df666991cfe2f43247b1646e44ae3248d105cd2575d091f36cde623b2af
|
7
|
+
data.tar.gz: 0a9206005c018a091301ddfc90b72a0ddd842c3e0e8ab9b29df632594a531d7203d53449e14d65d951d8a59333a062c80ab3fa52d7f95dba47e7d9779b97becb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/xmlregistry_objects.rb
CHANGED
@@ -5,30 +5,36 @@
|
|
5
5
|
|
6
6
|
require 'polyrex'
|
7
7
|
require 'dws-registry'
|
8
|
+
require 'rxfreader'
|
8
9
|
|
9
10
|
|
10
11
|
class XMLRegistryObjects
|
11
12
|
|
12
13
|
attr_reader :to_h
|
13
14
|
|
14
|
-
def initialize(reg, obj)
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def initialize(reg, obj, log: nil)
|
16
|
+
|
17
|
+
@log = log
|
18
|
+
log.info 'XMLRegistryObjects/initialize: active' if log
|
19
|
+
|
20
|
+
polyrexdoc = if obj.is_a? Polyrex then
|
21
|
+
|
18
22
|
obj
|
19
|
-
|
23
|
+
|
20
24
|
elsif obj.is_a? String then
|
21
|
-
|
22
|
-
buffer, type =
|
25
|
+
|
26
|
+
buffer, type = RXFReader.read obj
|
23
27
|
|
24
28
|
if type == :url then
|
25
29
|
Polyrex.new buffer
|
26
30
|
else
|
27
|
-
Polyrex.new.import "<?polyrex schema='entries/
|
31
|
+
Polyrex.new.import "<?polyrex schema='entries/objectx[name, regkey]/"\
|
28
32
|
"methodx[name,subkeyname]' delimiter=' = '?>\n" + obj
|
29
33
|
end
|
30
34
|
end
|
31
|
-
|
35
|
+
|
36
|
+
log.info 'XMLRegistryObjects/initialize: before @to_h' if log
|
37
|
+
|
32
38
|
@to_h = polyrexdoc.records.inject({}) do |rtn, row|
|
33
39
|
|
34
40
|
name, path = row.name, row.regkey[1..-2]
|
@@ -39,23 +45,23 @@ class XMLRegistryObjects
|
|
39
45
|
def initialize(reg)
|
40
46
|
@reg = reg
|
41
47
|
end
|
42
|
-
|
48
|
+
|
43
49
|
def last_modified()
|
44
50
|
lm = @reg.get_key('#{path}').attributes[:last_modified]
|
45
51
|
Time.parse(lm) if lm
|
46
52
|
end
|
47
|
-
|
48
|
-
def set(h)
|
49
|
-
|
53
|
+
|
54
|
+
def set(h)
|
55
|
+
|
50
56
|
h.each {|key,value| self.method((key.to_s + '=').to_sym).call value }
|
51
|
-
|
57
|
+
|
52
58
|
end
|
53
59
|
"
|
54
60
|
|
55
61
|
s = if row.records.any? then
|
56
62
|
|
57
63
|
row.records.inject(base_methods) do |r, attr|
|
58
|
-
|
64
|
+
|
59
65
|
attr_name, subkey = attr.name, attr.subkeyname[/\w+$/]
|
60
66
|
key = path + '/' + subkey
|
61
67
|
|
@@ -67,56 +73,60 @@ class XMLRegistryObjects
|
|
67
73
|
else
|
68
74
|
|
69
75
|
a = reg.xpath("#{path}/*")
|
70
|
-
|
71
|
-
a.inject(base_methods) do |r, x|
|
76
|
+
|
77
|
+
a.inject(base_methods) do |r, x|
|
72
78
|
|
73
79
|
methods_name = subkey = x.name
|
74
80
|
|
75
|
-
type = x.attributes[:type]
|
81
|
+
type = x.attributes[:type]
|
76
82
|
key = path + '/' + subkey
|
77
|
-
|
78
|
-
r << make_setdef(key, method_name=subkey)
|
79
83
|
|
80
|
-
|
84
|
+
r << make_setdef(key, method_name=subkey)
|
85
|
+
|
86
|
+
method_name += '?' if type and type == 'boolean'
|
81
87
|
r << make_def(key, method_name)
|
82
88
|
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
92
|
+
log.info 'XMLRegistryObjects/initialize: before class_eval ' + klass.to_s if log
|
93
|
+
|
86
94
|
klass.class_eval s
|
87
95
|
rtn.merge name.to_sym => klass.new(reg)
|
88
96
|
|
89
97
|
end
|
98
|
+
|
99
|
+
log.info 'XMLRegistryObjects/initialize: completed' if log
|
90
100
|
end
|
91
|
-
|
101
|
+
|
92
102
|
def define_methods()
|
93
103
|
@to_h.each.map {|k,v| "define_method :#{k.to_s}, ->{h[:#{k}]}"}.join("\n")
|
94
104
|
end
|
95
|
-
|
96
|
-
# to use this method the client is expect to fetch the
|
97
|
-
# hash object from the registry object e.g.
|
105
|
+
|
106
|
+
# to use this method the client is expect to fetch the
|
107
|
+
# hash object from the registry object e.g.
|
98
108
|
# xro = XMLRegistryObjects.new(reg,list)
|
99
109
|
# @h = xro.to_h
|
100
|
-
|
110
|
+
|
101
111
|
def define_methods2(obj=nil)
|
102
|
-
|
112
|
+
|
103
113
|
a = @to_h.each.map {|k,v| [k.to_s.to_sym, ->{@h[k.to_sym]} ] }
|
104
|
-
|
114
|
+
|
105
115
|
if obj then
|
106
|
-
|
116
|
+
|
107
117
|
a.each {|name, blk| obj.class.send(:define_method, name, blk) }
|
108
|
-
|
118
|
+
|
109
119
|
else
|
110
|
-
|
120
|
+
|
111
121
|
return a
|
112
|
-
|
122
|
+
|
113
123
|
end
|
114
|
-
|
115
|
-
end
|
124
|
+
|
125
|
+
end
|
116
126
|
|
117
127
|
private
|
118
128
|
|
119
|
-
def make_def(key, method_name)
|
129
|
+
def make_def(key, method_name)
|
120
130
|
<<-EOF
|
121
131
|
def #{method_name}()
|
122
132
|
@reg.get_key('#{key}', auto_detect_type: true)
|
@@ -124,9 +134,9 @@ end
|
|
124
134
|
|
125
135
|
EOF
|
126
136
|
end
|
127
|
-
|
128
|
-
def make_setdef(key, method_name)
|
137
|
+
|
138
|
+
def make_setdef(key, method_name)
|
129
139
|
"def #{method_name}=(v) @reg.set_key '#{key}', v end\n"
|
130
|
-
end
|
140
|
+
end
|
131
141
|
|
132
|
-
end
|
142
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlregistry_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIyMjAzMzQwWhcN
|
15
|
+
MjMwMjIyMjAzMzQwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDjoLXS
|
17
|
+
JY+GeI0u2RX39kso2JcNAsJ6/nlvNKRbADfUhw/J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FDgLOjZODHv/XMDI3YtyOLvFmUcQZnGwLAlpDT/GoEF71Mt3Ncnt9Z2Qt5gkr
|
33
|
+
p0+dnQ2LSGJRkn/RkGz3HM7aJcEV/nZO5b/7h61JbQ6Sg9p6Ailmub27VF6YUsO5
|
34
|
+
fAZEEr9vu8+K5z8LD0W7sdGbUMiz6qLKYzL5A1ERYZBqlY7J6Bo0alRRclzDpcJV
|
35
|
+
xxskbsrcVBnIBOJst+8ciwIklNVWeyO9DgHgc7XczsjNVAwtBywJ2OqePLHwzypv
|
36
|
+
j1b+b2ovUi70hCFO+BJGE3t0
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: dws-registry
|
@@ -39,42 +43,42 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
46
|
+
version: '0.5'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
49
|
+
version: 0.5.0
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0.
|
56
|
+
version: '0.5'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
59
|
+
version: 0.5.0
|
56
60
|
- !ruby/object:Gem::Dependency
|
57
61
|
name: polyrex
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
64
|
- - "~>"
|
61
65
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
66
|
+
version: '1.4'
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.0
|
69
|
+
version: 1.4.0
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
74
|
- - "~>"
|
71
75
|
- !ruby/object:Gem::Version
|
72
|
-
version: '1.
|
76
|
+
version: '1.4'
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0
|
79
|
+
version: 1.4.0
|
76
80
|
description:
|
77
|
-
email:
|
81
|
+
email: digital.robertson@gmail.com
|
78
82
|
executables: []
|
79
83
|
extensions: []
|
80
84
|
extra_rdoc_files: []
|
@@ -99,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
103
|
- !ruby/object:Gem::Version
|
100
104
|
version: '0'
|
101
105
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.5.1
|
106
|
+
rubygems_version: 3.2.22
|
104
107
|
signing_key:
|
105
108
|
specification_version: 4
|
106
109
|
summary: Query the registry using objects built dynamically from a string which maps
|
metadata.gz.sig
CHANGED
Binary file
|