line-tree 0.5.8 → 0.6.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 +0 -0
- data/lib/line-tree.rb +8 -3
- data.tar.gz.sig +1 -2
- metadata +7 -7
- 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: 05d33607cf41ebd4fb8415ccf95b3db6bec3f6da
|
4
|
+
data.tar.gz: 30af0b6cc6c52c57c466e0eca2fa562d0ef45a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c7907e54d39fcaf796729c2eb41a2252651e514fdba2dc975137e9ec7565c10cff1c2f248852b191e52eb3d03ec6a44342437d721a292672c4242154c71b2f
|
7
|
+
data.tar.gz: b330b2b8030fb7e79c435964f2df122b6ccde1eb7de4c022a9775749a63af6e6bbe0b23f6dffc9683e5635105c3d7b81bd9cafdfd2d6f9055499c13e979ae149
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/line-tree.rb
CHANGED
@@ -4,12 +4,13 @@
|
|
4
4
|
|
5
5
|
require 'rexle'
|
6
6
|
|
7
|
+
|
7
8
|
class LineTree
|
8
9
|
|
9
10
|
attr_reader :to_a
|
10
11
|
|
11
12
|
def initialize(s, level: nil, ignore_non_element: true,
|
12
|
-
|
13
|
+
ignore_blank_lines: true, ignore_label: false)
|
13
14
|
|
14
15
|
@ignore_non_element = ignore_non_element
|
15
16
|
@ignore_label = ignore_label
|
@@ -31,6 +32,7 @@ class LineTree
|
|
31
32
|
|
32
33
|
level -= 1 if level
|
33
34
|
|
35
|
+
return [] if lines.strip.empty?
|
34
36
|
a = lines.split(/(?=^\S+)/)
|
35
37
|
|
36
38
|
return [a] if a.length <= 1 and a.first.strip.empty?
|
@@ -39,12 +41,15 @@ class LineTree
|
|
39
41
|
|
40
42
|
if @ignore_label == true or not x[/.*/][/^ *\w+:\S+/] then
|
41
43
|
|
42
|
-
rlines = x.lines.map
|
44
|
+
rlines = x.lines.map do |x|
|
45
|
+
x.sub(/(.)\n$/,'\1')
|
46
|
+
end
|
43
47
|
|
44
48
|
rlines = [x.gsub(/^ {2}/,'')] if level and level < 0
|
49
|
+
|
45
50
|
label = [rlines.shift]
|
46
51
|
new_lines = rlines.map{|x| x.sub(/^ {2}/,'')}
|
47
|
-
|
52
|
+
|
48
53
|
if new_lines.length > 1 then
|
49
54
|
label + scan_shift(new_lines.join("\n"),level)
|
50
55
|
else
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�P�Kf����9���䤻�):���h"�y6<�Q.�06�HI�0��i��
|
1
|
+
��y��_ݖ"���2.)H|p+���sHV���QyI��j��@������2Lȣ��]�z[q�Z����Y��P��K'�6#�Qv�,(2���ɋX�=��%�+��)�tsuC�j�A�+E��H���=������~��A�Im[[�=x����;��j%?w tf�?�PK��Aᴕ�Tj�Gn����I�����;7���Č_xNnbLj��0zGtr�������>/���9�1>/� f�
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
m6UjuCKOiPqABbG2jvwjzF2RT9/yszKHPuB+qsEDC9HhonU7t7xizbYXXFCa7Ocj
|
32
32
|
UE2/ecWxKMEncA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-12-22 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle
|
@@ -39,20 +39,20 @@ dependencies:
|
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
42
|
+
version: '1.4'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
45
|
+
version: 1.4.10
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
52
|
+
version: '1.4'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 1.4.10
|
56
56
|
description: Line-tree parses indented lines of text and returns an array representing
|
57
57
|
a tree structure.
|
58
58
|
email: james@r0bertson.co.uk
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.6.
|
84
|
+
rubygems_version: 2.6.13
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|