abalone 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/abalone.rb +8 -4
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cdad8f9c302f699c2ac1ec4ad0d7ac5bc4e16e1
4
- data.tar.gz: d2c9862f6c4aa8337487c285a3b02fe73c0a19e0
3
+ metadata.gz: cf7b62895d93f13d9861d2c5ce5c2ab33a09a06c
4
+ data.tar.gz: 367318f5b93c858b63e81938dbcd9306581490b7
5
5
  SHA512:
6
- metadata.gz: baa34215faa681b8e7eef176bb774f15578b51999a66c73c13a0ccdeb03a171c137aa09d5ecae27749bb34a6e713eae19b18e1dde4022cac8c566bb3a240cca2
7
- data.tar.gz: 8e7ebbc4c01c6730713a6469425f1e94a5a832d9d6754981a2d6a58dc50683c345514f9d67ad02c0cfdaca69fb2a270792412afa4565ce283857c7931751332e
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
  ---
@@ -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('c*') # we read non-blocking to stream data as quickly as we can
55
- index = output.rindex { |x| x < 128 } # find the last low bit
56
- carry = output[index...-11] # save the any remaining high bits and partial chars for next go-round
57
- data = (carry + output[0..index]).pack('c*').force_encoding('UTF-8') # and pack the rest back into a string to send
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.0
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-05-12 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra