rxraw-lineparser 0.1.17 → 0.2.0
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 +3 -1
- data.tar.gz.sig +0 -0
- data/lib/rxraw-lineparser.rb +35 -28
- 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: a12efc9aa2b177fac1172501c4445fb992a021dc
|
4
|
+
data.tar.gz: 94f31fe33f4d3f4339ba69ce74be570238548e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24faa9d469cbdf05282189df052c83032b026332615ab1a8e1c28768de41f252533e77a3e6ef63205c9d9b3a8514f49c5cb0411e4a53810ae08913eddf6ef3a
|
7
|
+
data.tar.gz: a06362c4018a4008540493bccafbb6c2559d5fd91edf23520307436fa29e34e88a66cc8bd038af4867e0d3afdb03b7052c57b7249f800c69529f92d5aad64f4f
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
����B!R3����$�2��H�r�h����prQp��A��k���t��u�E��m͗*
|
2
|
+
�
|
3
|
+
/�q쓯,A�ף�iSQƚ�h�ȷ@t�O+�����q*Yj��Ǭ�5�M��ϟ�m���x,�G4��đs�/D��@ ���%מ���D�7վ��d9���6q���p��:.�Z����(��DNM�v�0�,�jI#�y�#���6����8ez����lZ��6�-��_�9!��?���=�+�cg
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rxraw-lineparser.rb
CHANGED
@@ -29,44 +29,51 @@ class RXRawLineParser
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def parse(line)
|
32
|
+
|
33
|
+
if @format_mask.to_s.include? '(?<' then
|
32
34
|
|
33
|
-
|
35
|
+
r = line.match(/#{@format_mask}/)
|
36
|
+
field_names, field_values = r.names, r.captures
|
37
|
+
|
38
|
+
else
|
34
39
|
|
35
|
-
|
36
|
-
# format_mask is detected
|
37
|
-
pattern = if @format_mask[0] != '\\' then
|
40
|
+
field_names = @format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
38
41
|
|
39
|
-
patterns
|
42
|
+
# only perform possible patterns to match when a custom
|
43
|
+
# format_mask is detected
|
44
|
+
pattern = if @format_mask[0] != '\\' then
|
40
45
|
|
41
|
-
|
42
|
-
and field_names.length > 1 then
|
43
|
-
insert2space_patterns(field_names.length, patterns)
|
44
|
-
end
|
46
|
+
patterns = possible_patterns(@format_mask)
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
if field_names.map{|x| "[!%s]" % x}.join(' ') == @format_mask \
|
49
|
+
and field_names.length > 1 then
|
50
|
+
insert2space_patterns(field_names.length, patterns)
|
51
|
+
end
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
else
|
54
|
-
pattern
|
55
|
-
end
|
56
|
-
else
|
53
|
+
pattern = patterns.detect do |x|
|
54
|
+
line.match(/#{x.join}/)
|
55
|
+
end.join
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
if patterns.length > 1 then
|
58
|
+
end_part = @format_mask[/[^\]]+$/].to_s
|
59
|
+
pattern += end_part
|
60
|
+
else
|
61
|
+
pattern
|
62
|
+
end
|
63
|
+
else
|
63
64
|
|
64
|
-
|
65
|
+
@format_mask.gsub(/\[!\w+\]/,'(.*)')
|
66
|
+
end
|
67
|
+
|
68
|
+
field_values = line.match(/#{pattern}/).captures.map(&:strip)
|
65
69
|
|
66
|
-
|
67
|
-
found_quotes.each {|i| field_values[i] = field_values[i][1..-2]}
|
68
|
-
end
|
70
|
+
found_quotes = find_qpattern(pattern)
|
69
71
|
|
72
|
+
if found_quotes then
|
73
|
+
found_quotes.each {|i| field_values[i] = field_values[i][1..-2]}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
70
77
|
field_values += [''] * (field_names.length - field_values.length)
|
71
78
|
|
72
79
|
[field_names, field_values]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rxraw-lineparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
y45JMqhHAfolGfPEOTYT4AtwQxTDUs67uvebNBxsU8sh31pL8L0zX3jIz1bVhNHQ
|
32
32
|
4p4pAlul6ELCYA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-
|
34
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
35
35
|
dependencies: []
|
36
36
|
description:
|
37
37
|
email: james@r0bertson.co.uk
|
metadata.gz.sig
CHANGED
Binary file
|