lib/riddle/client/response.rb in riddle-1.3.3 vs lib/riddle/client/response.rb in riddle-1.4.0

- old
+ new

@@ -15,80 +15,80 @@ def next len = next_int result = @str[@marker, len] @marker += len - return result + Riddle.encode(result) end # Return the next integer value from the stream def next_int int = @str[@marker, 4].unpack('N*').first @marker += 4 - return int + int end def next_64bit_int high, low = @str[@marker, 8].unpack('N*N*')[0..1] @marker += 8 - return (high << 32) + low + (high << 32) + low end # Return the next float value from the stream def next_float float = @str[@marker, 4].unpack('N*').pack('L').unpack('f*').first @marker += 4 - return float + float end # Returns an array of string items def next_array count = next_int items = [] - for i in 0...count + count.times do items << self.next end - return items + items end # Returns an array of int items def next_int_array count = next_int items = [] - for i in 0...count + count.times do items << self.next_int end - return items + items end def next_float_array count = next_int items = [] - for i in 0...count + count.times do items << self.next_float end - return items + items end def next_64bit_int_array count = next_int items = [] - for i in 0...count + count.times do items << self.next_64bit_int end - return items + items end # Returns the length of the streamed data def length @str.length end end end -end \ No newline at end of file +end