monga 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,23 +64,21 @@ module Monga::Connections
64
64
  end
65
65
 
66
66
  def parse_doc
67
- @str_io = nil if @number_returned == @response[7]
67
+ if @number_returned == @response[7]
68
+ @current_pos = @position
69
+ @str_io = nil
70
+ end
68
71
 
69
- current_pos = @position
70
72
  while @number_returned > 0
73
+ break if @buffer_size - @position < 4
71
74
  doc_length = ::BinUtils.get_int32_le(@buffer, @position)
72
75
  break if @buffer_size - @position < doc_length
73
76
  @number_returned -= 1
74
77
  @position += doc_length
75
78
  end
76
79
 
77
- if @str_io
78
- @str_io << @buffer[current_pos..@position]
79
- else
80
- @str_io = StringIO.new @buffer[current_pos..@position]
81
- end
82
-
83
80
  if @number_returned == 0
81
+ @str_io = StringIO.new @buffer[@current_pos..@position]
84
82
  @str_io.rewind
85
83
  @response[7].times do
86
84
  @response[-1] << BSON::Document.from_bson(@str_io)
data/monga.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "monga"
7
- spec.version = "0.0.9"
7
+ spec.version = "0.0.10"
8
8
  spec.authors = ["Petr Yanovich"]
9
9
  spec.email = ["fl00r@yandex.ru"]
10
10
  spec.description = %q{Yet another MongoDB Ruby Client}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
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-07-06 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: -2074336869759750845
184
+ hash: -4608881135826432488
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  none: false
187
187
  requirements:
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  segments:
192
192
  - 0
193
- hash: -2074336869759750845
193
+ hash: -4608881135826432488
194
194
  requirements: []
195
195
  rubyforge_project:
196
196
  rubygems_version: 1.8.25