line-tree 0.6.4 → 0.6.5
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/line-tree.rb +46 -3
- metadata +21 -22
- 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: 6b4b22d5dd403ed22809c08aaebeb57a76889c0c
|
4
|
+
data.tar.gz: 6ad7d18163ea3699505688431839cd311deeb04a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ec7b24163fe79f24ad6144310b06788d2bece2b3553b932f7fc030adf16fec329bdd465d06fb7552f6bcd6fe100c5a5530bfad7be80fab593e1cb51f8878d9
|
7
|
+
data.tar.gz: acefb20af3c12a45e90baaf65b15c20eb5d607ad3d89099727778896c4dd7fb0f87c964fdba9b290894a9a0643f5abb8836df076fbc97f5ae3ac41ddbcf626c8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/line-tree.rb
CHANGED
@@ -11,7 +11,7 @@ class LineTree
|
|
11
11
|
|
12
12
|
def initialize(raw_s, level: nil, ignore_non_element: true,
|
13
13
|
ignore_blank_lines: true, ignore_label: false,
|
14
|
-
ignore_newline: true, root: nil)
|
14
|
+
ignore_newline: true, root: nil, debug: false)
|
15
15
|
|
16
16
|
s = root ? root + "\n" + raw_s.lines.map {|x| ' ' + x}.join : raw_s
|
17
17
|
|
@@ -19,14 +19,29 @@ class LineTree
|
|
19
19
|
@ignore_label = ignore_label
|
20
20
|
@ignore_blank_lines = ignore_blank_lines
|
21
21
|
@ignore_newline = ignore_newline
|
22
|
+
@debug = debug
|
22
23
|
|
23
24
|
lines = ignore_blank_lines ? s.gsub(/^ *$\n/,'') : s
|
24
25
|
|
25
26
|
@to_a = scan_shift(lines.strip, level)
|
27
|
+
|
26
28
|
end
|
27
29
|
|
28
|
-
def to_doc()
|
29
|
-
|
30
|
+
def to_doc(encapsulate: false)
|
31
|
+
|
32
|
+
a = @to_a
|
33
|
+
|
34
|
+
a2 = if a[0].is_a? Array then
|
35
|
+
encapsulate ? encap(a) : scan_a(a)
|
36
|
+
else
|
37
|
+
scan_a(*a)
|
38
|
+
end
|
39
|
+
|
40
|
+
a2.unshift('root', {})
|
41
|
+
puts 'a2: ' + a2.inspect if @debug
|
42
|
+
|
43
|
+
Rexle.new(a2)
|
44
|
+
|
30
45
|
end
|
31
46
|
|
32
47
|
def to_xml(options={})
|
@@ -34,6 +49,34 @@ class LineTree
|
|
34
49
|
end
|
35
50
|
|
36
51
|
private
|
52
|
+
|
53
|
+
def encap(a)
|
54
|
+
|
55
|
+
puts '_a: ' + a.inspect
|
56
|
+
|
57
|
+
a.each do |node|
|
58
|
+
|
59
|
+
encap node[-1] if node[-1].is_a? Array
|
60
|
+
|
61
|
+
if node.is_a? Array then
|
62
|
+
val = node[0]
|
63
|
+
node.insert 1, {}, val
|
64
|
+
node[0] = 'entry'
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
puts '2a: ' + a.inspect
|
70
|
+
|
71
|
+
if a.first.is_a? String then
|
72
|
+
val = a[0]
|
73
|
+
a.insert 1, {}, val
|
74
|
+
a[0] = 'entry'
|
75
|
+
end
|
76
|
+
|
77
|
+
a
|
78
|
+
|
79
|
+
end
|
37
80
|
|
38
81
|
def scan_shift(lines, level=nil)
|
39
82
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: line-tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ bindir: bin
|
|
10
10
|
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Nvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
|
25
|
+
ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAJDE/cZXxbtNL3kdBI/s
|
26
|
+
1mfpSyBdiq0T8FLvRFvoQ9TBrahG6awJv6qqYEd2DE6MuH2cEv1pQjUaF3OMtBow
|
27
|
+
BF5w4qoEYnntuO+cNCPqz8/5Q2+r+UaJSBHAcC/Q4XJHmqZP+eYLncyJsZNjR3gg
|
28
|
+
jWox9KwQxNYAjZsEoWGNEVrKy4RQemwjFqqLi1vzaru0FswbXlUwBw8fN2BtEZbA
|
29
|
+
K/OeBpT0safUWMP7zzLzq0BnYAPwfE6771wbpYxzTMqMcrFjSUgWJP/5/URIsqXN
|
30
|
+
wN+2fv6EC2h0XIvfmiFpfz1F3AiA5cWUW8HuIO87gQy/9YbBrh4VK9WSnVaVEv0u
|
31
|
+
6gM=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date: 2018-
|
33
|
+
date: 2018-03-15 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: rexle
|
metadata.gz.sig
CHANGED
Binary file
|