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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79829f89db29d691d99775c875bbef337b2774bc
4
- data.tar.gz: b57ee15eb09cdb7df25fe5a1c884b9c60365776e
3
+ metadata.gz: 6b4b22d5dd403ed22809c08aaebeb57a76889c0c
4
+ data.tar.gz: 6ad7d18163ea3699505688431839cd311deeb04a
5
5
  SHA512:
6
- metadata.gz: 871b6c6fa609374a448775ba06f06a27249d6f9f6c92cc24cfc277a209643c7156bfa7691ba8c708c2ae924ae31ccfaf4c1ae2d602c466d32383b9d9e486122a
7
- data.tar.gz: b8bc3a93b824266de88ae1e6323698f59d6f8d3509fb4bfd7ef3e832055eba10d0c3082161a9be9dc829e97320107d1d9297491c26661c68203c5b402f5eb26e
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
- Rexle.new(scan_a(*@to_a).first)
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
4
+ version: 0.6.5
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
- 8ixkARkWAmV1MB4XDTE3MDMwNTIwMTYzOFoXDTE4MDMwNTIwM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2+r+UaJSBHAcC/Q4XJHmqZP+eYLncyJsZNjR3gg
28
+ jWox9KwQxNYAjZsEoWGNEVrKy4RQemwjFqqLi1vzaru0FswbXlUwBw8fN2BtEZbA
29
+ K/OeBpT0safUWMP7zzLzq0BnYAPwfE6771wbpYxzTMqMcrFjSUgWJP/5/URIsqXN
30
+ wN+2fv6EC2h0XIvfmiFpfz1F3AiA5cWUW8HuIO87gQy/9YbBrh4VK9WSnVaVEv0u
31
+ 6gM=
33
32
  -----END CERTIFICATE-----
34
- date: 2018-02-09 00:00:00.000000000 Z
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