polyrex-links 0.1.10 → 0.4.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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/lib/polyrex-links.rb +95 -7
- metadata +32 -28
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8964a224bb312d07bcc1a24ca3df8350c26ee39ae1c1d4437ad53ca6741e9cf8
|
4
|
+
data.tar.gz: 38a6fffecdb3f792e0d7cb4bdc08456e8c550bd069a4304d227444727ad0c69e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f84201d8eee6df717d0a99d1464776239476afad86f8ab7bf83a1d711777226c90381478ea3b7579e67f91241e03c4febe60eb01093ed3336a0e44c2aa09bae
|
7
|
+
data.tar.gz: df19c602da175197d3f6b2797c1df4314dc63e9d4ee1e48609435ca2d46139028194b570fb05f842b6d4961ff182f6335019644e8f80dbb98c69c9a90b7b6244
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��x6�����x
|
1
|
+
7��!.Ƃ��%륁CH�+e�4a6�Q����Y�or�����p�n�x��V���tùW2��P��7x�K����_�/�?��݁�˙����F�%�����m��؟�(�"�}�#�y�^!#E|5���N��G il7#���>*,�_��bC�W��fC�hcF�=������?f��(�����LDlR�EF�}hZW3����&vF� �贰k�#�C~��{�+萠2�����}�
|
data/lib/polyrex-links.rb
CHANGED
@@ -6,18 +6,65 @@ require 'polyrex'
|
|
6
6
|
|
7
7
|
class PolyrexLinks < Polyrex
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
11
|
-
|
9
|
+
def initialize(rawx='links/link[name,url]', delimiter: ' # ', debug: false)
|
10
|
+
|
11
|
+
x, _ = RXFHelper.read(rawx)
|
12
|
+
obj = x.lstrip.sub(/<\?polyrex-links\?>/,
|
13
|
+
'<?polyrex schema="links/link[name,url]" delimiter=" # "?>')
|
14
|
+
puts 'obj: ' + x.inspect if debug
|
15
|
+
|
16
|
+
super(obj)
|
17
|
+
@delimiter = self.delimiter = delimiter
|
18
|
+
@debug = debug
|
19
|
+
|
12
20
|
end
|
13
|
-
|
14
|
-
def
|
21
|
+
|
22
|
+
def find(s)
|
23
|
+
|
24
|
+
found = find_by_link_name s
|
15
25
|
|
26
|
+
if found then
|
27
|
+
|
28
|
+
path = backtrack_path found
|
29
|
+
[link(path.join('/')), path.join('/')]
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def migrate(raws)
|
36
|
+
|
37
|
+
s, _ = RXFHelper.read(raws)
|
38
|
+
pl = PolyrexLinks.new("<?polyrex-links?>\n\n" + s.sub(/<\?[^\?]+\?>/,'').lstrip)
|
39
|
+
|
40
|
+
pl.each_recursive do |x|
|
41
|
+
link, linkpath = find(x.name)
|
42
|
+
x.url = link.url if link.url
|
43
|
+
end
|
44
|
+
|
45
|
+
pl
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns the Polyrex element for the given path
|
50
|
+
#
|
51
|
+
def link(s)
|
52
|
+
|
53
|
+
self.rxpath(s.split('/').map {|x| "link[name='%s']" % x}.join('/')).first
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns the url and remaining arguments for the given path
|
58
|
+
#
|
59
|
+
def locate(raw_path)
|
60
|
+
|
61
|
+
return nil if raw_path.nil? or raw_path.strip.empty?
|
16
62
|
path = raw_path.sub(/^\//,'')
|
17
63
|
a = path.split('/')
|
18
64
|
a2 = []
|
19
65
|
(a2 << a.clone; a.pop) while a.any?
|
20
|
-
|
66
|
+
return nil if a2.empty?
|
67
|
+
|
21
68
|
mask = "records/link[summary/name='%s']"
|
22
69
|
|
23
70
|
begin
|
@@ -27,7 +74,48 @@ class PolyrexLinks < Polyrex
|
|
27
74
|
|
28
75
|
# return the found path along with any remaining string which
|
29
76
|
# it didn't find, or it will return nil.
|
30
|
-
|
77
|
+
|
78
|
+
puts "c: %s\npath: %s\nr: %s" % [c, path, r].map(&:inspect) if @debug
|
79
|
+
|
80
|
+
r ? [r, path.sub(c.join('/'),'')] : nil
|
31
81
|
end
|
82
|
+
|
83
|
+
|
84
|
+
# Return a flat Hash object containing all the links. The link path is
|
85
|
+
# used as the key and the value is the url
|
86
|
+
#
|
87
|
+
def to_h()
|
88
|
+
|
89
|
+
h = {}
|
90
|
+
|
91
|
+
each_link {|key, value| h[key] = value }
|
92
|
+
h
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def backtrack_path(e, a5=[])
|
99
|
+
|
100
|
+
backtrack_path(e.parent, a5) if e.parent?
|
101
|
+
a5 << e.name
|
102
|
+
|
103
|
+
return a5
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
def each_link()
|
108
|
+
|
109
|
+
a = []
|
110
|
+
|
111
|
+
self.each_recursive() do |record, _, i|
|
112
|
+
|
113
|
+
a.slice!(i..-1)
|
114
|
+
a[i] = record
|
115
|
+
yield(a.map(&:name).join('/'), record.url) if block_given?
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
32
120
|
|
33
121
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyrex-links
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----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AsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUke21GuFM
|
26
|
+
jVaog26Uc04gxKe1iCwwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAjIJYPq1LH/BCICN8vgvNFgGs21y/cfvb9xHYlzFW
|
29
|
+
rsugnb0Z/o4KFuR4F8JceTgBAhwCKnsXltjamYjw+VfcF/4KVtmgiFKjS35kTCu1
|
30
|
+
bTemc4gbHKjwz03kh35lDFD6sfqCumtifHBPNZjYXB3Nxlel+ECHLtj7NP4K14wJ
|
31
|
+
yu/k6V++dimd0zKocsIOSwuOUCbn9q3sXu0ZNippHdpyYtaj76BFURASv2xVj4KR
|
32
|
+
sIkI6KVVE15q6hrjxLInQX2GH6frDr6I6w7ltuDhI8I3TkW9C/W5vuoHyWCiG9qX
|
33
|
+
cBRqqQiCW7xMi8SCyoVCJydO3Js8E0gFrbg6R9XcsIt2yaktptXEcY4hm+yWlkJD
|
34
|
+
Nnidax6k9ikNRlpzL5AhDq6nRARm+7bJAr/4Ln3SswnLtXW6//WkQyReUJMDgRo9
|
35
|
+
5x/50O2gHQvmLgSVk8EsWqPZ6B8tMZ9h/ttCIkW33ewCmHrrxH9suuyqbC/SaiEf
|
36
|
+
2qE86MpuEcgDiX59WiP5GiBx
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: polyrex
|
@@ -38,22 +43,22 @@ dependencies:
|
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '1.
|
46
|
+
version: '1.3'
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.2
|
49
|
+
version: 1.3.2
|
45
50
|
type: :runtime
|
46
51
|
prerelease: false
|
47
52
|
version_requirements: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - "~>"
|
50
55
|
- !ruby/object:Gem::Version
|
51
|
-
version: '1.
|
56
|
+
version: '1.3'
|
52
57
|
- - ">="
|
53
58
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2
|
59
|
+
version: 1.3.2
|
55
60
|
description:
|
56
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
57
62
|
executables: []
|
58
63
|
extensions: []
|
59
64
|
extra_rdoc_files: []
|
@@ -78,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
83
|
- !ruby/object:Gem::Version
|
79
84
|
version: '0'
|
80
85
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.6.13
|
86
|
+
rubygems_version: 3.1.2
|
83
87
|
signing_key:
|
84
88
|
specification_version: 4
|
85
89
|
summary: A convenient gem for retrieving a link from a hierarchical lookup table from
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
�`�粇[�����l�Zc��I\Q��(d51�{b/�NP�`�Kq�09�t�K�X��<�>�7�僥_��aG�a�&��GY1�|�s���:s�Q��At��j�?ɱ0�˫ʆ��"o�`H��
|