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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/line-tree.rb +10 -3
- 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: 35f9480caccfa3233e3a6ec2b2dbaab3c5ddf8bd
|
4
|
+
data.tar.gz: 7fb35339a544a9413078fb85bdf2bd954c0d7807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
61
|
-
|
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.
|
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-
|
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
|