uv-rays 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uv-rays/abstract_tokenizer.rb +2 -1
- data/lib/uv-rays/buffered_tokenizer.rb +5 -6
- data/lib/uv-rays/version.rb +1 -1
- data/spec/abstract_tokenizer_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b968faec5c418f8ee37b41606159333d3f0458f
|
4
|
+
data.tar.gz: d0ba56974349746c9db68e4b52abdf26bc60803c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb3efe38bb16b15ee9b90fbe049c40b09effecdcdd142eb309a90fb07ddbf287d3cfe090668b141aad692f595f568d913e03a2d656ccfea78f7d931b14adadf
|
7
|
+
data.tar.gz: ff93f781f3e477cdaa01040ce49c150555254366a5b344a15152e9e5b8825354cb6a29aac5d1b01733060b2cc1adcc4652485de00ca756ff94ad724d86f529d8
|
@@ -31,7 +31,6 @@ module UV
|
|
31
31
|
if @delimiter
|
32
32
|
@extract_method = method(:delimiter_extract)
|
33
33
|
elsif @indicator && @msg_length
|
34
|
-
@length_index = @msg_length - 1
|
35
34
|
@extract_method = method(:length_extract)
|
36
35
|
else
|
37
36
|
raise ArgumentError, 'no delimiter provided'
|
@@ -112,13 +111,13 @@ module UV
|
|
112
111
|
|
113
112
|
# Select messages of the right size then remove junk data
|
114
113
|
messages.select! { |msg| msg.length >= @msg_length ? true : false }
|
115
|
-
messages.map! { |msg| msg[0
|
114
|
+
messages.map! { |msg| msg[0...@msg_length] }
|
116
115
|
|
117
116
|
if last.length >= @msg_length
|
118
|
-
messages << last[0
|
117
|
+
messages << last[0...@msg_length]
|
119
118
|
@input = last[@msg_length..-1]
|
120
119
|
else
|
121
|
-
|
120
|
+
reset("#{@indicator}#{last}")
|
122
121
|
end
|
123
122
|
|
124
123
|
check_buffer_limits
|
@@ -151,8 +150,8 @@ module UV
|
|
151
150
|
end
|
152
151
|
end
|
153
152
|
|
154
|
-
def reset
|
155
|
-
@input =
|
153
|
+
def reset(value = '')
|
154
|
+
@input = value
|
156
155
|
@input.force_encoding(@encoding) if @encoding
|
157
156
|
end
|
158
157
|
end
|
data/lib/uv-rays/version.rb
CHANGED
@@ -41,6 +41,14 @@ describe UV::AbstractTokenizer do
|
|
41
41
|
expect(result).to eq(['1234', '1234'])
|
42
42
|
expect(@buffer.flush).to eq('56') # as we've indicated a message length of 4
|
43
43
|
end
|
44
|
+
|
45
|
+
it "should not return junk data" do
|
46
|
+
msg1 = "Start123456Start123456"
|
47
|
+
|
48
|
+
result = @buffer.extract(msg1)
|
49
|
+
expect(result).to eq(['1234', '1234'])
|
50
|
+
expect(@buffer.flush).to eq('56') # as we've indicated a message length of 4
|
51
|
+
end
|
44
52
|
|
45
53
|
it "should tokenize messages where the indicator is split" do
|
46
54
|
msg1 = "123Star"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uv-rays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libuv
|