polyrex-links 0.1.7 → 0.3.1
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.tar.gz.sig +0 -0
- data/lib/polyrex-links.rb +53 -5
- metadata +43 -30
- 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: 4bd12c77d61cf0b1cfc72812388fb6905dea692dd47b2a15f4552658fd251026
|
4
|
+
data.tar.gz: d1f62513696b431a28a0402f4108659e476d49df785f8e0ad9459cf7880a869d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b28beb444c7984ab881c4edbbe44c27fdd932e791f29b2f3f6c24606dfb43c84aff74a8b98975ed896d50aa243eccbd9a3138b3f25765654ceb79bff13d3b8a
|
7
|
+
data.tar.gz: 888c6e76766752725df3d205c3e582128aa77da82bb3e73319a0f74f52a2c0c7106cc1673dffa1ec4ee2df4dae2ead77015ad8ca462afa9e044ebf0dae13376f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/polyrex-links.rb
CHANGED
@@ -6,16 +6,31 @@ require 'polyrex'
|
|
6
6
|
|
7
7
|
class PolyrexLinks < Polyrex
|
8
8
|
|
9
|
-
def initialize(x='links/link[name,url]')
|
9
|
+
def initialize(x='links/link[name,url]', delimiter: ' # ', debug: false)
|
10
10
|
super(x)
|
11
|
+
@delimiter = self.delimiter = delimiter
|
12
|
+
@debug = debug
|
11
13
|
end
|
12
|
-
|
13
|
-
|
14
|
+
|
15
|
+
# Returns the Polyrex element for the given path
|
16
|
+
#
|
17
|
+
def link(s)
|
18
|
+
|
19
|
+
self.rxpath(s.split('/').map {|x| "link[name='%s']" % x}.join('/')).first
|
14
20
|
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the url and remaining arguments for the given path
|
24
|
+
#
|
25
|
+
def locate(raw_path)
|
26
|
+
|
27
|
+
return nil if raw_path.nil? or raw_path.strip.empty?
|
28
|
+
path = raw_path.sub(/^\//,'')
|
15
29
|
a = path.split('/')
|
16
30
|
a2 = []
|
17
31
|
(a2 << a.clone; a.pop) while a.any?
|
18
|
-
|
32
|
+
return nil if a2.empty?
|
33
|
+
|
19
34
|
mask = "records/link[summary/name='%s']"
|
20
35
|
|
21
36
|
begin
|
@@ -25,7 +40,40 @@ class PolyrexLinks < Polyrex
|
|
25
40
|
|
26
41
|
# return the found path along with any remaining string which
|
27
42
|
# it didn't find, or it will return nil.
|
28
|
-
|
43
|
+
|
44
|
+
puts "c: %s\npath: %s\nr: %s" % [c, path, r].map(&:inspect) if @debug
|
45
|
+
|
46
|
+
r ? [r, path.sub(c.join('/'),'')] : nil
|
29
47
|
end
|
48
|
+
|
49
|
+
|
50
|
+
# Return a flat Hash object containing all the links. The link path is
|
51
|
+
# used as the key and the value is the url
|
52
|
+
#
|
53
|
+
def to_h()
|
54
|
+
|
55
|
+
h = {}
|
56
|
+
|
57
|
+
each_link {|key, value| h[key] = value }
|
58
|
+
h
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
|
65
|
+
def each_link()
|
66
|
+
|
67
|
+
a = []
|
68
|
+
|
69
|
+
self.each_recursive() do |record, _, i|
|
70
|
+
|
71
|
+
a.slice!(i..-1)
|
72
|
+
a[i] = record
|
73
|
+
yield(a.map(&:name).join('/'), record.url) if block_given?
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
30
78
|
|
31
79
|
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.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,43 +10,55 @@ 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
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjI3MTUxODE4WhcN
|
15
|
+
MjIwMjI3MTUxODE4WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCdtqiT
|
17
|
+
0WUTjIB9AjlZAkqkD9DB5TTRiRmNEN1Hfq4mtVpj56axPBwoR7fuZJSutczmuy9K
|
18
|
+
avOwyfG5SZqqPGYAQspwg758CnP6c+rF29lMVYkoR8PiCryQK9tXBGPV33CS+T1k
|
19
|
+
4lQGttd8wgN55YSRkAtl/AuKmJr4zNFwY6kE0fwFWIBaw2grKJBrZUe2WTjBC4to
|
20
|
+
GIEP9/ehRvpiPDVsF6KY5QGPsGKDEBBPR/P5ChG6OuP5qv8wKUSw4eLMQbY81n+/
|
21
|
+
X2F/8FfpLGKjDboMMygHyWi+pJRiaSqzxB6WL5Q8bnIkelbw4LKhck5kWx0gl5cv
|
22
|
+
WLPtarEFK3Ac3kg9FzjsgvW/IJDKDn9TmYWsNKIqGj1j8vdc7sksfcch7rmKRIsD
|
23
|
+
zWoLCS+djhi0v2f8u9Yp5cJB0e6oyNHSkMUD44uefHAZOeT/u3kZvL6aOAjpS1A8
|
24
|
+
IaxkwwjginilyBHSpyPruxcNyiaDvJ/D+C7xzM5XbkbQzOwFf5Ml0UDwPgsCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUke21GuFM
|
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
|
31
37
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
38
|
+
date: 2021-02-27 00:00:00.000000000 Z
|
33
39
|
dependencies:
|
34
40
|
- !ruby/object:Gem::Dependency
|
35
41
|
name: polyrex
|
36
42
|
requirement: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 1.2.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.2'
|
41
50
|
type: :runtime
|
42
51
|
prerelease: false
|
43
52
|
version_requirements: !ruby/object:Gem::Requirement
|
44
53
|
requirements:
|
45
|
-
- -
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.2.0
|
57
|
+
- - "~>"
|
46
58
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
59
|
+
version: '1.2'
|
48
60
|
description:
|
49
|
-
email: james@
|
61
|
+
email: james@jamesrobertson.eu
|
50
62
|
executables: []
|
51
63
|
extensions: []
|
52
64
|
extra_rdoc_files: []
|
@@ -62,18 +74,19 @@ require_paths:
|
|
62
74
|
- lib
|
63
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
76
|
requirements:
|
65
|
-
- -
|
77
|
+
- - ">="
|
66
78
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
79
|
+
version: 2.1.2
|
68
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
81
|
requirements:
|
70
|
-
- -
|
82
|
+
- - ">="
|
71
83
|
- !ruby/object:Gem::Version
|
72
84
|
version: '0'
|
73
85
|
requirements: []
|
74
86
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.7.10
|
76
88
|
signing_key:
|
77
89
|
specification_version: 4
|
78
|
-
summary:
|
90
|
+
summary: A convenient gem for retrieving a link from a hierarchical lookup table from
|
91
|
+
a raw Polyrex document format
|
79
92
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|