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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 861acb2bfe5dece74d77373d39eee7852b8d160f
4
- data.tar.gz: 7f647200148c792ae4be5140ed1e1d9aa3468923
3
+ metadata.gz: 22acb4e3bff109ff17650ba24a2371672c47a219
4
+ data.tar.gz: 8db95862fd0948a6e9d2ec852e3e2ab056951103
5
5
  SHA512:
6
- metadata.gz: bd2743125a7723e0b7a9aff79726a9be1d969e9dd76849e3e83f9aafda9c29d44aedef2ade68a197f97b49552bd3cd0a8302ae345b8dd4fe89d1b1574b64fb59
7
- data.tar.gz: 68dc158e4a2a4a3d1dcc886ce0e33f27c8b3d7e081b617694b751a740d26b43baa965cffe0ff00a7618f26880d90827b44f4a65efe38c5eef750a4243609d592
6
+ metadata.gz: c077b880f321fa8ffad432847b9b21070902b14be81ac157bbaec3df44ce6caae2bf9c570c80c6c12435baf247d8f2451491a4e8c878591a3c1c28d9dac367cd
7
+ data.tar.gz: db56d2b2f13ed395f1e0f524aa3811da6ea32dcf9eebd87d39988e63891a78ecc76aad7801b7359ca87c67d4dfa3ddd329ce59008fc58dcdb48b37f5f5e7314e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- @doc = Rexle.new(r)
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.2
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
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE2MDMxMDAwMjU1NVoXDTE3MDMxMDAwMjU1NVowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBG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wsZhc2KRruS/uxo1qFl0quQ109YEiSYs
29
+ +UZe2+kLKoniW9sFyGobrNT/WPb6M4Mpl1IwD44ma8LYZMUyUFC1F6d4DJyb4r01
30
+ IS0FWuXg2ZTracza00uK7RtXeyeqhtdehcN/2kb1nyM7j55+U4Jw1Ta5UgC5izw6
31
+ 6+E=
33
32
  -----END CERTIFICATE-----
34
- date: 2016-05-01 00:00:00.000000000 Z
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.3'
41
+ version: '1.4'
43
42
  - - ">="
44
43
  - !ruby/object:Gem::Version
45
- version: 1.3.30
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.3'
51
+ version: '1.4'
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: 1.3.30
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@r0bertson.co.uk
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.4.8
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