polyrex-schema 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/polyrex-schema.rb +25 -12
- metadata +47 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22acb4e3bff109ff17650ba24a2371672c47a219
|
4
|
+
data.tar.gz: 8db95862fd0948a6e9d2ec852e3e2ab056951103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c077b880f321fa8ffad432847b9b21070902b14be81ac157bbaec3df44ce6caae2bf9c570c80c6c12435baf247d8f2451491a4e8c878591a3c1c28d9dac367cd
|
7
|
+
data.tar.gz: db56d2b2f13ed395f1e0f524aa3811da6ea32dcf9eebd87d39988e63891a78ecc76aad7801b7359ca87c67d4dfa3ddd329ce59008fc58dcdb48b37f5f5e7314e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/polyrex-schema.rb
CHANGED
@@ -3,24 +3,41 @@
|
|
3
3
|
# file: polyrex-schema.rb
|
4
4
|
|
5
5
|
require 'rexle'
|
6
|
+
require 'rexle-builder'
|
6
7
|
|
7
8
|
class PolyrexSchema
|
8
9
|
|
9
|
-
attr_reader :to_schema
|
10
|
+
attr_reader :to_schema, :to_a, :to_h, :to_doc, :to_s
|
10
11
|
|
11
12
|
def initialize(s=nil)
|
12
13
|
|
13
14
|
if s then
|
14
|
-
s.prepend 'root/' if s[0] == '{'
|
15
|
-
|
16
|
-
r = add_node split(s)
|
17
|
-
r[3] << node('recordx_type', 'polyrex')
|
18
15
|
|
19
|
-
|
16
|
+
if s =~ /\// then
|
17
|
+
s.prepend 'root/' if s[0] == '{'
|
18
|
+
|
19
|
+
r = add_node split(s)
|
20
|
+
r[3] << node('recordx_type', 'polyrex')
|
21
|
+
|
22
|
+
@doc = Rexle.new(r)
|
23
|
+
|
24
|
+
@to_a = scan_to_a(@doc.root.xpath 'records/*')
|
25
|
+
@to_h = scan_to_h(@doc.root.xpath 'records/*')
|
26
|
+
@to_doc = @doc
|
27
|
+
@to_s = @doc.to_s
|
28
|
+
|
29
|
+
else
|
30
|
+
|
31
|
+
a = [s[/^[^\[]+/], *s[/(?<=\[)[^\]]+/].split(/ *, */)].map(&:to_sym)
|
32
|
+
@to_a = [a]
|
33
|
+
|
34
|
+
h = {a[0] => {summary: a[1..-1].zip(Array.new(a.length-1)).to_h,
|
35
|
+
records: nil }}
|
36
|
+
@to_doc = Rexle.new(RexleBuilder.new(h).to_a)
|
37
|
+
end
|
20
38
|
|
21
39
|
end
|
22
40
|
end
|
23
|
-
|
24
41
|
|
25
42
|
def parse(s)
|
26
43
|
doc = Rexle.new s
|
@@ -28,10 +45,6 @@ class PolyrexSchema
|
|
28
45
|
self
|
29
46
|
end
|
30
47
|
|
31
|
-
def to_a() scan_to_a(@doc.root.xpath 'records/*') end
|
32
|
-
def to_h() scan_to_h(@doc.root.xpath 'records/*') end
|
33
|
-
def to_doc() @doc end
|
34
|
-
def to_s() @doc.to_s end
|
35
48
|
|
36
49
|
private
|
37
50
|
|
@@ -146,4 +159,4 @@ class PolyrexSchema
|
|
146
159
|
|
147
160
|
end
|
148
161
|
|
149
|
-
end
|
162
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyrex-schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
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lcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAD/kdUlFPD5XCUhxywA1
|
26
|
+
kv6n6k8qWm/yYbXoTEzJh6zf3voHzMDHhA5I1YeZm2Sh4sKhJ8FF2k11hAeoejJx
|
27
|
+
LBsp1By9sC91+CzF2HVIThgxelw2DxWjYWsKe3r0EJHr4yE2otOnp4XkYWIrYfU5
|
28
|
+
l35BecM9c913FuK6hzPbnZsTZ4n1HFG/wsZhc2KRruS/uxo1qFl0quQ109YEiSYs
|
29
|
+
+UZe2+kLKoniW9sFyGobrNT/WPb6M4Mpl1IwD44ma8LYZMUyUFC1F6d4DJyb4r01
|
30
|
+
IS0FWuXg2ZTracza00uK7RtXeyeqhtdehcN/2kb1nyM7j55+U4Jw1Ta5UgC5izw6
|
31
|
+
6+E=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
33
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: rexle
|
@@ -39,22 +38,42 @@ dependencies:
|
|
39
38
|
requirements:
|
40
39
|
- - "~>"
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
41
|
+
version: '1.4'
|
43
42
|
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
44
|
+
version: 1.4.12
|
46
45
|
type: :runtime
|
47
46
|
prerelease: false
|
48
47
|
version_requirements: !ruby/object:Gem::Requirement
|
49
48
|
requirements:
|
50
49
|
- - "~>"
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
51
|
+
version: '1.4'
|
53
52
|
- - ">="
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
54
|
+
version: 1.4.12
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rexle-builder
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.3.8
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0.3'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.3.8
|
56
75
|
description:
|
57
|
-
email: james@
|
76
|
+
email: james@jamesrobertson.eu
|
58
77
|
executables: []
|
59
78
|
extensions: []
|
60
79
|
extra_rdoc_files: []
|
@@ -80,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
99
|
version: '0'
|
81
100
|
requirements: []
|
82
101
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.6.13
|
84
103
|
signing_key:
|
85
104
|
specification_version: 4
|
86
105
|
summary: The polyrex-schema gem creates Polyrex XML from an initial shorthand schematic
|
metadata.gz.sig
CHANGED
Binary file
|