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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8ad1231ba9340b8a58766193e468e162dbe7ad4
4
- data.tar.gz: 7aff2188e2f7c190c84842ae2de40fc16dcb0d6e
3
+ metadata.gz: a12efc9aa2b177fac1172501c4445fb992a021dc
4
+ data.tar.gz: 94f31fe33f4d3f4339ba69ce74be570238548e29
5
5
  SHA512:
6
- metadata.gz: 8e8775be83defa653e19521ecde88621aca99bb0216d961911e16b8a345072486135b95a1154032dc410696dd29243b6dcfaf78ec511120e7d773ea59a130734
7
- data.tar.gz: dcc819807480b5dca5e2396157fe035fa6b1d194143bceeeebc8fd310ade7d1099e50565804bde6eb17a99ae7d40fe9d8c17ebe43bff990ae35c8ef0407a7e45
6
+ metadata.gz: e24faa9d469cbdf05282189df052c83032b026332615ab1a8e1c28768de41f252533e77a3e6ef63205c9d9b3a8514f49c5cb0411e4a53810ae08913eddf6ef3a
7
+ data.tar.gz: a06362c4018a4008540493bccafbb6c2559d5fd91edf23520307436fa29e34e88a66cc8bd038af4867e0d3afdb03b7052c57b7249f800c69529f92d5aad64f4f
@@ -1 +1,3 @@
1
- of�/ ���~��lO����|ojH�%~����A����ǘ8�|k��U�#6 ���t�e)�`�E�)���(F��]�D2����,�X��[SB5B��"��R.|�^����7blX��ݦ����ܙ�7���iώ�O9�E��ȡ�7��������A�w���CP��p�f]kQ��^t������^/��56�l�@��b���1�,W۠����Q?�q[���Ω}A��%�{�2��/��Җzy�
1
+ ����B!R3����$�2��Hrh����prQp��A��k���t��uE��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
@@ -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
- field_names = @format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
35
+ r = line.match(/#{@format_mask}/)
36
+ field_names, field_values = r.names, r.captures
37
+
38
+ else
34
39
 
35
- # only perform possible patterns to match when a custom
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 = possible_patterns(@format_mask)
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
- if field_names.map{|x| "[!%s]" % x}.join(' ') == @format_mask \
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
- pattern = patterns.detect do |x|
47
- line.match(/#{x.join}/)
48
- end.join
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
- if patterns.length > 1 then
51
- end_part = @format_mask[/[^\]]+$/].to_s
52
- pattern += end_part
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
- @format_mask.gsub(/\[!\w+\]/,'(.*)')
59
- end
60
-
61
- field_values = line.match(/#{pattern}/).captures.map(&:strip)
62
- #field_values = line.match(/#{@format_mask}/).captures.map(&:strip)
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
- found_quotes = find_qpattern(pattern)
65
+ @format_mask.gsub(/\[!\w+\]/,'(.*)')
66
+ end
67
+
68
+ field_values = line.match(/#{pattern}/).captures.map(&:strip)
65
69
 
66
- if found_quotes then
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.1.17
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-09-27 00:00:00.000000000 Z
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