abalone 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/abalone.rb +8 -4
- 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: cf7b62895d93f13d9861d2c5ce5c2ab33a09a06c
|
4
|
+
data.tar.gz: 367318f5b93c858b63e81938dbcd9306581490b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7341f2dcd7f603c0c30fc28811927f61fe8383a5789a637cfe3635ebdec06dd76819b4f4153e77d780a8ed224410703ef026fd0627f9e74097ec4bd5defc6fa
|
7
|
+
data.tar.gz: 94985e52ad596aba1788dc28e4f802d0a9b183f5ed52c010c730f12eef6147ea30bbe58058d724ed3279b8f5287d470898135c133e49f4d852f74a3ed5fdec48
|
data/README.md
CHANGED
@@ -76,7 +76,7 @@ command without providing any options, the config file would look like:
|
|
76
76
|
#### Simple options
|
77
77
|
|
78
78
|
You can also allow the user to pass in a arbitrary options. These must be
|
79
|
-
whitelisted. You can simply list allowed options in an Array:
|
79
|
+
whitelisted. You can simply list allowed options in an Array:
|
80
80
|
|
81
81
|
``` Yaml
|
82
82
|
---
|
data/lib/abalone.rb
CHANGED
@@ -51,16 +51,20 @@ class Abalone < Sinatra::Base
|
|
51
51
|
loop do
|
52
52
|
begin
|
53
53
|
PTY.check(@pid, true)
|
54
|
-
output = reader.read_nonblock(512).unpack('
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
output = reader.read_nonblock(512).unpack('C*') # we read non-blocking to stream data as quickly as we can
|
55
|
+
last_low = output.rindex { |x| x < 128 } # find the last low bit
|
56
|
+
trailing = last_low +1
|
57
|
+
|
58
|
+
# use inclusive slices here
|
59
|
+
data = (carry + output[0..last_low]).pack('C*').force_encoding('UTF-8') # repack into a string up until the last low bit
|
60
|
+
carry = output[trailing..-1] # save the any remaining high bits and partial chars for next go-round
|
58
61
|
|
59
62
|
ws.send(data)
|
60
63
|
|
61
64
|
rescue IO::WaitReadable
|
62
65
|
IO.select([reader])
|
63
66
|
retry
|
67
|
+
|
64
68
|
rescue PTY::ChildExited => e
|
65
69
|
warn('Terminal has exited!')
|
66
70
|
ws.close_connection
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abalone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Ford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|