line-tree 0.5.1 → 0.5.2
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 +6 -5
- metadata +2 -2
- 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: 283168e8e2b3adbe5cea9a53be413966d1a4f7d1
|
4
|
+
data.tar.gz: 2998e5da93c039f456a59eb2e9e6c25857801960
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be1ef7f0f963a9431ffa9f59891a42287ee218ff876ebd95edea2b67f5f56b7bd2761400c9dae804de3b83843fb39efebd0c701d37b196b39706f0189771566d
|
7
|
+
data.tar.gz: 7e295fb0f386b5b1d6a6f0557c4dc4223095dfe5c7032c290c88d81bcbd61d5333dead657fd56e8df338465c5756ac4e132302ab0f7f691c88cc4fa671f402aa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/line-tree.rb
CHANGED
@@ -4,16 +4,17 @@
|
|
4
4
|
|
5
5
|
require 'rexle'
|
6
6
|
|
7
|
-
class LineTree
|
7
|
+
class LineTree
|
8
8
|
|
9
9
|
attr_reader :to_a
|
10
10
|
|
11
|
-
def initialize(
|
11
|
+
def initialize(s, level: nil, ignore_non_element: true,
|
12
12
|
ignore_blank_lines: true, ignore_label: false)
|
13
13
|
|
14
14
|
@ignore_non_element = ignore_non_element
|
15
|
-
@ignore_blank_lines = ignore_blank_lines
|
16
15
|
@ignore_label = ignore_label
|
16
|
+
|
17
|
+
lines = ignore_blank_lines ? s.gsub(/^$\n/,'') : s
|
17
18
|
@to_a = scan_shift(lines.strip, level)
|
18
19
|
end
|
19
20
|
|
@@ -34,7 +35,7 @@ class LineTree
|
|
34
35
|
|
35
36
|
if @ignore_label == true or not x[/.*/][/^\s*\w+:\S+/] then
|
36
37
|
|
37
|
-
rlines =
|
38
|
+
rlines = (x).split(/\n/,-1)
|
38
39
|
|
39
40
|
rlines = [x.gsub(/^\s{2}/,'')] if level and level < 0
|
40
41
|
label = [rlines.shift]
|
@@ -118,4 +119,4 @@ class LineTree
|
|
118
119
|
end
|
119
120
|
|
120
121
|
|
121
|
-
end
|
122
|
+
end
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
ErtlSTAImlBCK8q5BS4jBBt8VAEpNdkWpWbtDtLPA639pW2QWIcPx13ObWJh7Ejk
|
32
32
|
THoVqqsHTfeg3g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-02-
|
34
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle
|
metadata.gz.sig
CHANGED
Binary file
|