sectionx 0.4.1 → 0.4.2

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
- SHA1:
3
- metadata.gz: ac8a7ebe2e9fd4d9496e6a5178efbdf4c7293bb2
4
- data.tar.gz: be48f55c653c5f40646bcdcb04971f0da2c845e9
2
+ SHA256:
3
+ metadata.gz: 4d5ee09c486b5a7c78b44260bf1071e86755023de614c8202edf472bfb3bdecc
4
+ data.tar.gz: 71812c5472522812adc526224cdffb83809361b1e99df823f1a7c8ec735996db
5
5
  SHA512:
6
- metadata.gz: fe2ee4899f715ca458e3d4313dd60946805999969e92f9774924de572861f3973da88f254dddb3357ea39de667ff908b98622efbfe718aa2cf502c390da4b4f7
7
- data.tar.gz: b37c6df0eb61153779da654dccf2d4ff88ce657dbfdee9eb939781e3593f6483f7e5b7bc620c7d29f9ea265edd3e894b62e1baf11192f8eb618c4ea01ae44c6d
6
+ metadata.gz: 2d11a4ebfe809cc64261a3a325e007defa0a4c2b0a46e17a9f754c91bcfc9aaba3e94f6dbb543c6f29c4d106451c398412225d6fba2c832a87a2f1d7d0025135
7
+ data.tar.gz: fb00102a23afc8ec47cb1827397d7d7297c4ffaea188c4851a97ea203449605442f7e189a64942f0c856c9118b2a30412aad618920babe093b74b23dd53cc629
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/sectionx.rb CHANGED
@@ -12,7 +12,9 @@ class SectionX
12
12
 
13
13
  attr_reader :attributes, :summary, :sections
14
14
 
15
- def initialize(x=nil)
15
+ def initialize(x=nil, debug: false)
16
+
17
+ @debug = debug
16
18
 
17
19
  @doc = if x.is_a? String then
18
20
  buffer, _ = RXFHelper.read x
@@ -81,6 +83,17 @@ class SectionX
81
83
  @doc.xml(options)
82
84
  end
83
85
 
86
+ def update(id=nil, h={})
87
+
88
+ puts 'inside update h: ' + h.inspect if @debug
89
+ xpath = "summary/" + h.keys.first.to_s
90
+ puts 'xpath: ' + xpath.inspect if @debug
91
+ e = @doc.root.element(xpath)
92
+ puts 'e: ' + e.inspect if @debug
93
+ e.text = h.values.first if e
94
+ puts '@doc: ' + @doc.xml if @debug
95
+ end
96
+
84
97
  def xpath(x)
85
98
  @doc.root.xpath(x)
86
99
  end
@@ -103,9 +116,16 @@ class SectionX
103
116
 
104
117
  def build_section(xml, raw_rows)
105
118
 
106
- section_name = raw_rows.shift
107
-
108
- attr = section_name ? {title: section_name} : {}
119
+ puts 'raw_rows : ' + raw_rows.inspect
120
+ raw_section_name = raw_rows.shift
121
+ puts 'section_name : ' + raw_section_name.inspect
122
+
123
+ attr = if raw_section_name then
124
+ section_name = raw_section_name[/[\w\s]+/]
125
+ {title: section_name}
126
+ else
127
+ {}
128
+ end
109
129
 
110
130
  xml.section(attr) do
111
131
 
@@ -131,8 +151,8 @@ class SectionX
131
151
 
132
152
  def indent_heading(s, heading='#')
133
153
 
134
- a = s.split(/(?=^\s*#{heading}\s*\w)/).map do |x|
135
-
154
+ a = s.split(/(?=^\s*#{heading}\s*[\[\w])/).map do |x|
155
+ puts 'x : ' + x.inspect
136
156
  heading_title = x[/^\s*#{heading}\s*.*/]
137
157
 
138
158
  if heading_title then
@@ -156,24 +176,8 @@ class SectionX
156
176
  def parse_root_node(e)
157
177
 
158
178
  attributes = e.attributes
159
- summary = RecordX.new e.xpath('summary/*')
160
- summary_methods = (summary.keys - self.public_methods)
161
-
162
- summary_methods.each do |x|
163
-
164
- instance_eval "
165
-
166
- def #{x.to_sym}()
167
- @summary[:#{x}]
168
- end
169
-
170
- def #{x.to_s}=(v)
171
- @summary[:#{x}] = v
172
- @doc.root.element('summary/#{x.to_s}').text = v
173
- end
174
- "
175
- end
176
-
179
+ summary = RecordX.new e.xpath('summary/*'), self, debug: @debug
180
+
177
181
  a = e.xpath('sections/section')
178
182
 
179
183
  return [attributes, summary] if a.empty?
@@ -182,7 +186,7 @@ class SectionX
182
186
 
183
187
  if a[0] and a[0].attributes.empty? then
184
188
  section1 = a.shift
185
- sections = {'' => SectionX.new(section1)}
189
+ sections = {'' => SectionX.new(section1, debug: true)}
186
190
  end
187
191
 
188
192
  sections = a.inject(sections) do |r, section|
@@ -191,7 +195,7 @@ class SectionX
191
195
  name = (h[:id] || h[:title].gsub(/\s+/,'_')).downcase
192
196
 
193
197
  instance_eval "def #{name}() self.sections[:#{name}] end"
194
- r.merge(name.downcase.to_sym => SectionX.new(section))
198
+ r.merge(name.to_sym => SectionX.new(section, debug: @debug))
195
199
  end
196
200
 
197
201
  [attributes, summary, sections]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sectionx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
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
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MDIyMzIxMDM1OFoXDTE2MDIyMzIxMDM1OFowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBANUhQ0jRPxKyNshsQpT6KNb7RhQ+YU2bUAL3i0uCQi27EAtd60q/1POpc15N
19
- W3h0qwbvkiF3QbeVvPiM/hx13o02A3u3cJZjVgnKPe4cvgWBEHEkSevY+FM/u+XC
20
- RpQUHSIwlE/MrmEK0yZne3g0Uu7uVStNQ7QEdF7df8cbtKy8Hyua3Y1TUlajs34N
21
- ec9n3mIMelaOrRbv1NaxXB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+ 6EiX+A00/gVzAutvGarXRnUN+ContjXeNx1T++VtRCyAdrQKTjnWz9eeN0T8G1rw
34
+ NtxeeZrVRefak2ZAClTycMOYL/DO1I22njjMo8fXDjBcPoQawzChx7yKc4DUjmGg
35
+ lPw+nNEEQBBBOO6255zdlyzYtxsHXnEKJYvUjl4/Z/YIa2Y+VgLolw8kPC0Z0Ztw
36
+ TLvN099jf8wfGlEJ/VkEKkXV
33
37
  -----END CERTIFICATE-----
34
- date: 2015-03-01 00:00:00.000000000 Z
38
+ date: 2018-10-02 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: line-tree
@@ -39,82 +43,82 @@ dependencies:
39
43
  requirements:
40
44
  - - "~>"
41
45
  - !ruby/object:Gem::Version
42
- version: '0.5'
46
+ version: '0.7'
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: 0.5.3
49
+ version: 0.7.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.5'
56
+ version: '0.7'
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: 0.5.3
59
+ version: 0.7.0
56
60
  - !ruby/object:Gem::Dependency
57
61
  name: rexle-builder
58
62
  requirement: !ruby/object:Gem::Requirement
59
63
  requirements:
60
64
  - - "~>"
61
65
  - !ruby/object:Gem::Version
62
- version: '0.2'
66
+ version: '0.3'
63
67
  - - ">="
64
68
  - !ruby/object:Gem::Version
65
- version: 0.2.1
69
+ version: 0.3.13
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: '0.2'
76
+ version: '0.3'
73
77
  - - ">="
74
78
  - !ruby/object:Gem::Version
75
- version: 0.2.1
79
+ version: 0.3.13
76
80
  - !ruby/object:Gem::Dependency
77
81
  name: rxfhelper
78
82
  requirement: !ruby/object:Gem::Requirement
79
83
  requirements:
80
84
  - - "~>"
81
85
  - !ruby/object:Gem::Version
82
- version: '0.2'
86
+ version: '0.8'
83
87
  - - ">="
84
88
  - !ruby/object:Gem::Version
85
- version: 0.2.1
89
+ version: 0.8.7
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
93
  requirements:
90
94
  - - "~>"
91
95
  - !ruby/object:Gem::Version
92
- version: '0.2'
96
+ version: '0.8'
93
97
  - - ">="
94
98
  - !ruby/object:Gem::Version
95
- version: 0.2.1
99
+ version: 0.8.7
96
100
  - !ruby/object:Gem::Dependency
97
101
  name: recordx
98
102
  requirement: !ruby/object:Gem::Requirement
99
103
  requirements:
100
104
  - - "~>"
101
105
  - !ruby/object:Gem::Version
102
- version: '0.1'
106
+ version: '0.5'
103
107
  - - ">="
104
108
  - !ruby/object:Gem::Version
105
- version: 0.1.16
109
+ version: 0.5.3
106
110
  type: :runtime
107
111
  prerelease: false
108
112
  version_requirements: !ruby/object:Gem::Requirement
109
113
  requirements:
110
114
  - - "~>"
111
115
  - !ruby/object:Gem::Version
112
- version: '0.1'
116
+ version: '0.5'
113
117
  - - ">="
114
118
  - !ruby/object:Gem::Version
115
- version: 0.1.16
119
+ version: 0.5.3
116
120
  description:
117
- email: james@r0bertson.co.uk
121
+ email: james@jamesrobertson.eu
118
122
  executables: []
119
123
  extensions: []
120
124
  extra_rdoc_files: []
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
144
  version: '0'
141
145
  requirements: []
142
146
  rubyforge_project:
143
- rubygems_version: 2.2.2
147
+ rubygems_version: 2.7.6
144
148
  signing_key:
145
149
  specification_version: 4
146
150
  summary: Makes it convenient to store and retrieve hierarchical data in an XML format
metadata.gz.sig CHANGED
Binary file