Skip to content
This repository has been archived by the owner on Aug 8, 2019. It is now read-only.

write_buff fails on Ruby 1.8.7 due to missing String#byteslice #9

Open
sodabrew opened this issue Jul 16, 2014 · 2 comments
Open

write_buff fails on Ruby 1.8.7 due to missing String#byteslice #9

sodabrew opened this issue Jul 16, 2014 · 2 comments

Comments

@sodabrew
Copy link
Contributor

This code might never have hit the implicit else case before, because String#byteslice is not present in Ruby 1.8.7:
https://github.com/brightroll/unixrack/blob/master/lib/unixrack.rb#L64

      # buff could be UTF-8
      while true
        nw = io.syswrite(out_buff)
        nwritten = nwritten + nw
        break if nw == out_buff.bytesize
        out_buff = out_buff.byteslice(nw..-1)
      end
      nwritten
    end
@drudru
Copy link
Contributor

drudru commented Jul 16, 2014

cool - will check out - thx

@sodabrew
Copy link
Contributor Author

I rewrote the version of this method that I ported into RQ based on the Backports gem's implementation of byteslice using the unpack method:
https://github.com/brightroll/rq/blob/master/code/protocol.rb#L76-87

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants