line-tree 0.4.1 → 0.4.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: 34927fc0e7f9e55bab79c71bcf50b3f4c26edb0a
4
- data.tar.gz: 186c4daa0b0d66c99a827b5ba148d7ab795aeb86
3
+ metadata.gz: 35f9480caccfa3233e3a6ec2b2dbaab3c5ddf8bd
4
+ data.tar.gz: 7fb35339a544a9413078fb85bdf2bd954c0d7807
5
5
  SHA512:
6
- metadata.gz: 7d5238c533f67ee110b235fbedbb4000ca39f7b74a1323d1e8ee49c0781deec06f0bd764991ff92802bb914829412fa80782b0b8c20f2492f5d12496658d6ecb
7
- data.tar.gz: 5179885c6fc86d2bedbbb281b407892d4695cb584624b6758cf58a91ed0d20357e80118f71f357336ef07ffb0520dfc34580f39b75f9a28f582f46b92586d80d
6
+ metadata.gz: e104d6a9b7bbbe3adeffb64b53efdcb8b92c4978fd7a69d4bb84785b09804d98c36183730495f7a7a433d7e474946a7c2bf46c23f757304bcebd0652e4dde090
7
+ data.tar.gz: 8001ecb0b9d7b29818a03e394603a89bde65fdd0e81cf3196e1f78d9a22de947b08b8a6b2632fc6e8145763d6d7b520287833f2b59dbc534b50c6b9911f2007e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/line-tree.rb CHANGED
@@ -8,7 +8,11 @@ class LineTree
8
8
 
9
9
  attr_reader :to_a
10
10
 
11
- def initialize(lines, level: nil) @to_a = scan_shift(lines.strip, level) end
11
+ def initialize(lines, level: nil, ignore_non_element: true)
12
+
13
+ @ignore_non_element = ignore_non_element
14
+ @to_a = scan_shift(lines.strip, level)
15
+ end
12
16
 
13
17
  def to_xml(options={})
14
18
  a = scan_a(*@to_a).first
@@ -57,8 +61,11 @@ class LineTree
57
61
  def scan_a(a)
58
62
 
59
63
  s = a.shift
60
- non_element = s[/^\s*(\w+:)/,1]
61
- return [nil,non_element] if non_element
64
+
65
+ if @ignore_non_element then
66
+ non_element = s[/^\s*(\w+:)/,1]
67
+ return [nil,non_element] if non_element
68
+ end
62
69
 
63
70
  r = s.match(/('[^']+[']|[^\s]+)\s*(\{[^\}]+\})?\s*(.*)/m)
64
71
  .captures.values_at(0,-1,1)
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.1
4
+ version: 0.4.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: 2014-11-21 00:00:00.000000000 Z
34
+ date: 2014-12-04 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle
metadata.gz.sig CHANGED
Binary file