pry-remote-em 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,8 @@ module PryRemoteEm
5
5
  module Proto
6
6
  PREAMBLE = 'PRYEM'
7
7
  SEPERATOR = ' '
8
- PREAMBLE_LEN = PREAMBLE.length
9
- SEPERATOR_LEN = SEPERATOR.length
8
+ PREAMBLE_LEN = PREAMBLE.bytesize
9
+ SEPERATOR_LEN = SEPERATOR.bytesize
10
10
 
11
11
  def send_json(d)
12
12
  send_data(JSON.dump(d.is_a?(String) ? {:d => d} : d))
@@ -14,7 +14,7 @@ module PryRemoteEm
14
14
 
15
15
  def send_data(data)
16
16
  crc = Zlib::crc32(data).to_s
17
- msg = PREAMBLE + (data.length + crc.length + SEPERATOR_LEN).to_s + SEPERATOR + crc + SEPERATOR + data
17
+ msg = PREAMBLE + (data.bytesize + crc.bytesize + SEPERATOR_LEN).to_s + SEPERATOR + crc + SEPERATOR + data
18
18
  super(msg)
19
19
  end
20
20
 
@@ -27,18 +27,18 @@ module PryRemoteEm
27
27
  # an incomplete frame.
28
28
  # @example "PRYEM42 3900082256 {\"g\":\"PryRemoteEm 0.7.0 pryem\"}PRYEM22 1794245389 {\"a\":false}"
29
29
  def receive_data(d)
30
- return unless d && d.length > 0
30
+ return unless d && d.bytesize > 0
31
31
  @buffer ||= "" # inlieu of a post_init
32
32
  @buffer << d
33
33
  while @buffer && !@buffer.empty?
34
- return unless @buffer.length >= PREAMBLE_LEN &&
34
+ return unless @buffer.bytesize >= PREAMBLE_LEN &&
35
35
  (len_ends = @buffer.index(SEPERATOR)) &&
36
36
  (crc_ends = @buffer.index(SEPERATOR, len_ends))
37
37
  if (preamble = @buffer[0...PREAMBLE_LEN]) != PREAMBLE
38
38
  raise "message is not in proper format; expected #{PREAMBLE.inspect} not #{preamble.inspect}"
39
39
  end
40
40
  length = @buffer[PREAMBLE_LEN ... len_ends].to_i
41
- return if len_ends + length > @buffer.length
41
+ return if len_ends + length > @buffer.bytesize
42
42
  crc_start = len_ends + SEPERATOR_LEN
43
43
  crc, data = @buffer[crc_start ... crc_start + length].split(SEPERATOR, 2)
44
44
  crc = crc.to_i
@@ -1,3 +1,3 @@
1
1
  module PryRemoteEm
2
- VERSION = '0.7.4'
2
+ VERSION = '0.7.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-remote-em
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-11 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 1.8.24
119
+ rubygems_version: 1.8.25
120
120
  signing_key:
121
121
  specification_version: 3
122
122
  summary: Connect to Pry remotely using EventMachine