line-tree 0.5.8 → 0.6.0

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: 28a77ac6717ca7feb49b8e9b593255a7ba0a03e6
4
- data.tar.gz: 2ce6febf0fbc258ab069e556830657dcb4b90439
3
+ metadata.gz: 05d33607cf41ebd4fb8415ccf95b3db6bec3f6da
4
+ data.tar.gz: 30af0b6cc6c52c57c466e0eca2fa562d0ef45a2d
5
5
  SHA512:
6
- metadata.gz: 290375391fe15d6c51350e35fea2693059f9fe5d28c76d3c36e537e9459fd04fe27d78440fb9a5ab9ff10f50872be214b6424492923c280b495c5f859a216d85
7
- data.tar.gz: 249e6d804e922d65d5dd378d8d0a4680eebe7bff44f966a3a009bea1367419332a8f02abde4f8fd32fc6e1ae509de8e97ca547be542a202f9f264478ef1c15bf
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
- ignore_blank_lines: true, ignore_label: false)
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 {|x| x.sub(/(.)\n$/,'\1')}
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
- }Y�D��ņ��f]Yǭ�wB/c2iI](����������1WIlq��.�d��S�/@u��WR��3a����?���Y��\R�HV�LS=E�g�<��|t��tl�?�D�������:��80���`�y���hw3��goƎ\�U��֖��T�щP��u��y�|�B�7�P~}3w�� A���d�=��
2
- �P�Kf����9���䤻�):���h"�y6<�Q.�06�HI�0��i ��
1
+ ��y��_ݖ"���2.)H|p+���sHV���QyI��j��@������2Lȣ��]�z[qZ����Y��P��K'6#�Qv�,(2���ɋX�=��%�+��)tsuC�jA�+E�� H���=������~��AIm[[�=x����;��j%?w tf�?�PK��Aᴕ�TjGn����I�����;7 ���Č_xNnbLj��0zGtr�������>/���91>/� 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.5.8
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-06-03 00:00:00.000000000 Z
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.2'
42
+ version: '1.4'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2.14
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.2'
52
+ version: '1.4'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.2.14
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.8
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