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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dc0a2ebddd24813a4c01cb379e896ff4c9337e8
4
- data.tar.gz: 8905d2968e93145912111f231c5fcfed6c919b16
3
+ metadata.gz: 283168e8e2b3adbe5cea9a53be413966d1a4f7d1
4
+ data.tar.gz: 2998e5da93c039f456a59eb2e9e6c25857801960
5
5
  SHA512:
6
- metadata.gz: 75979a31a0ffb64a3d53b65e7507a1201fb53a02a727ab4a85bfe4eb01ab9abba17a5135728a80f8433bdc1d808af442a673e5f48a8a76d261a17ad94da667c1
7
- data.tar.gz: 44a63659914f28679fae8e41dc7acd0921959ec5c7c26d0de53bdd891ef5cc0c102d36d6e68386a1be7a2fc0994beb068fe0eea41fed85940077f57b3ff76bb8
6
+ metadata.gz: be1ef7f0f963a9431ffa9f59891a42287ee218ff876ebd95edea2b67f5f56b7bd2761400c9dae804de3b83843fb39efebd0c701d37b196b39706f0189771566d
7
+ data.tar.gz: 7e295fb0f386b5b1d6a6f0557c4dc4223095dfe5c7032c290c88d81bcbd61d5333dead657fd56e8df338465c5756ac4e132302ab0f7f691c88cc4fa671f402aa
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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(lines, level: nil, ignore_non_element: true,
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 = @ignore_blank_lines ? (x).split(/\n/) : (x).split(/\n/,-1)
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.1
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-16 00:00:00.000000000 Z
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