hflr 1.2.1 → 1.2.3

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.
Files changed (3) hide show
  1. data/hflr.gemspec +1 -1
  2. data/lib/hflr/fl_record_file.rb +12 -2
  3. metadata +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hflr}
5
- s.version = "1.2.1"
5
+ s.version = "1.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Colin Davis"]
@@ -31,10 +31,12 @@ class FLRFile
31
31
  end
32
32
  if @fast
33
33
  @width = get_record_width_from_file
34
+ puts "record width: #{@width}"
34
35
 
35
- records_to_take = 50000001 / @width
36
+ records_to_take = 100000000 / @width
36
37
 
37
38
  @buffer_size = @width * records_to_take
39
+ puts "buffer size: #{@buffer_size}"
38
40
 
39
41
  @position=0
40
42
  @current_buffer=nil
@@ -100,19 +102,25 @@ def fast_get_next_known_line_type
100
102
  unless @current_buffer.nil? && (@offsets.nil? || @offsets.empty?)
101
103
  if @current_buffer.nil?
102
104
  chunk = @offsets.shift
105
+ puts "About to read chunk #{chunk.inspect}"
103
106
 
104
107
  @file.pos = chunk.pos
105
108
  @current_buffer=@file.read(chunk.width)
109
+ puts "current_buffer set to #{@current_buffer}"
106
110
  record= @current_buffer.slice(@position,@width)
111
+ puts "Got record #{record}"
107
112
 
108
113
  @position += @width
114
+ puts "position: #{@position}"
109
115
  if @position >= @current_buffer.size
116
+ puts "Reseting buffer"
110
117
  @current_buffer = nil
111
118
  @position=0
112
119
  end
113
120
  return record
114
121
  else
115
122
  record= @current_buffer.slice(@position,@width)
123
+ puts "Got subsequent record #{record}"
116
124
  @position += @width
117
125
  if @position>=@current_buffer.size
118
126
  @position=0
@@ -195,11 +203,13 @@ def offsets_to_read(ranges, width)
195
203
  while !offsets.empty?
196
204
  taken << offsets.shift
197
205
  if taken.size * width == @buffer_size || offsets.empty?
198
- chunks << chunk.new(taken.first, taken.size * width)
206
+
207
+ chunks << chunk.new(taken.first * @width, taken.size * width)
199
208
  taken = []
200
209
  end # if
201
210
  end # while
202
211
  end # each
212
+
203
213
  chunks
204
214
  end
205
215
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hflr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.1
5
+ version: 1.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Colin Davis