sectionx 0.3.0 → 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 +4 -4
- checksums.yaml.gz.sig +2 -1
- data/lib/sectionx.rb +19 -9
- data.tar.gz.sig +0 -0
- metadata +8 -8
- 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: eb55c370128a3ed86e53695f3573fd767b56c5de
|
|
4
|
+
data.tar.gz: 4e198c9a6f8ff374eb1f95d2e09e88f8d63ee625
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcb197e99e30d892ec8410121925249b70c4814cc65a1bd6a4c1170f0613102bfc41370f211cb79e66326125a106bf1729f277e1a1b35b28987c2d66647e8bc4
|
|
7
|
+
data.tar.gz: 98dd6b1b0cdd40418df1ff5aa6cf3a4c04c24bf76cfc1ef17881f263f3f06230f7f75c6cb512edbac7975769d42819593c4b1dd0275233ab83078f5e648cafa7
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
�Y�$-X�2�T��X��cp9��<�S�,hȸ@աU\�#$�������~�J~�
|
|
2
|
+
bR��-��0���r;�;��%�$���l���v���mW�LJ�O��0
|
data/lib/sectionx.rb
CHANGED
|
@@ -10,7 +10,7 @@ require 'recordx'
|
|
|
10
10
|
|
|
11
11
|
class SectionX
|
|
12
12
|
|
|
13
|
-
attr_reader :summary, :sections
|
|
13
|
+
attr_reader :attributes, :summary, :sections
|
|
14
14
|
|
|
15
15
|
def initialize(x=nil)
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ class SectionX
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
if @doc then
|
|
24
|
-
@summary, @sections = parse_root_node @doc.root
|
|
24
|
+
@attributes, @summary, @sections = parse_root_node @doc.root
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ class SectionX
|
|
|
37
37
|
nested = indent_heading("# summary\n%s\n# begin\n%s" % [summary,\
|
|
38
38
|
body.strip])
|
|
39
39
|
a = LineTree.new(nested).to_a
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
raw_summary = a.shift
|
|
42
42
|
raw_summary.shift # removes the redundant summary label
|
|
43
43
|
|
|
@@ -64,7 +64,7 @@ class SectionX
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
@doc = Rexle.new a2
|
|
67
|
-
@summary, @sections = parse_root_node(@doc.root)
|
|
67
|
+
@attributes, @summary, @sections = parse_root_node(@doc.root)
|
|
68
68
|
|
|
69
69
|
self
|
|
70
70
|
end
|
|
@@ -155,6 +155,7 @@ class SectionX
|
|
|
155
155
|
|
|
156
156
|
def parse_root_node(e)
|
|
157
157
|
|
|
158
|
+
attributes = e.attributes
|
|
158
159
|
summary = RecordX.new e.xpath('summary/*')
|
|
159
160
|
summary_methods = (summary.keys - self.public_methods)
|
|
160
161
|
|
|
@@ -173,11 +174,20 @@ class SectionX
|
|
|
173
174
|
"
|
|
174
175
|
end
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
a = e.xpath('sections/section')
|
|
178
|
+
section1 = a.shift
|
|
179
|
+
sections = {'' => SectionX.new(section1)}
|
|
180
|
+
|
|
181
|
+
sections = a.inject(sections) do |r, section|
|
|
182
|
+
|
|
183
|
+
h = section.attributes
|
|
184
|
+
name = (h[:id] || h[:title].gsub(/\s+/,'_')).downcase
|
|
185
|
+
|
|
186
|
+
instance_eval "def #{name}() self.sections[:#{name}] end"
|
|
187
|
+
r.merge(name.downcase.to_sym => SectionX.new(section))
|
|
188
|
+
end
|
|
179
189
|
|
|
180
|
-
[summary, sections]
|
|
190
|
+
[attributes, summary, sections]
|
|
181
191
|
end
|
|
182
192
|
|
|
183
193
|
end
|
|
@@ -203,4 +213,4 @@ EOF
|
|
|
203
213
|
sx.import s
|
|
204
214
|
puts sx.to_xml pretty: true
|
|
205
215
|
|
|
206
|
-
end
|
|
216
|
+
end
|
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
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
fF3d7swBn//lagO6DAUK+663TP5+b44Iqo8hPzD1c9+c5WJjVDaCskt69Ue5+dlb
|
|
32
32
|
VamQ/GtAeu1Iyg==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2015-
|
|
34
|
+
date: 2015-03-01 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: line-tree
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '0.5'
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 0.5.
|
|
45
|
+
version: 0.5.3
|
|
46
46
|
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
version: '0.5'
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 0.5.
|
|
55
|
+
version: 0.5.3
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: rexle-builder
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,20 +79,20 @@ dependencies:
|
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0.
|
|
82
|
+
version: '0.2'
|
|
83
83
|
- - ">="
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: 0.1
|
|
85
|
+
version: 0.2.1
|
|
86
86
|
type: :runtime
|
|
87
87
|
prerelease: false
|
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
|
90
90
|
- - "~>"
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version: '0.
|
|
92
|
+
version: '0.2'
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.1
|
|
95
|
+
version: 0.2.1
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: recordx
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
|
Binary file
|