hflr 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/hflr.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hflr}
5
- s.version = "1.2.0"
5
+ s.version = "1.2.1"
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,11 +31,11 @@ class FLRFile
31
31
  end
32
32
  if @fast
33
33
  @width = get_record_width_from_file
34
- puts "record width #{@width.to_s}"
34
+
35
35
  records_to_take = 50000001 / @width
36
- puts "records_to_take: #{records_to_take}"
36
+
37
37
  @buffer_size = @width * records_to_take
38
- puts "Buffer size: #{@buffer_size}"
38
+
39
39
  @position=0
40
40
  @current_buffer=nil
41
41
  end
@@ -48,7 +48,7 @@ class FLRFile
48
48
  end
49
49
 
50
50
  @offsets =offsets_to_read(ranges, @width)
51
- puts "Chunks of data #{@offsets.inspect}"
51
+
52
52
  @ranges = ranges
53
53
  end
54
54
 
@@ -100,28 +100,29 @@ def fast_get_next_known_line_type
100
100
  unless @current_buffer.nil? && (@offsets.nil? || @offsets.empty?)
101
101
  if @current_buffer.nil?
102
102
  chunk = @offsets.shift
103
- puts "shifting first chunk #{chunk.inspect}"
103
+
104
104
  @file.pos = chunk.pos
105
105
  @current_buffer=@file.read(chunk.width)
106
106
  record= @current_buffer.slice(@position,@width)
107
- puts "Record was from #{@position} width of #{@width}"
108
- puts "Getting record: #{record}"
109
- @position += @width
110
- puts "Position incremented to #{@position}"
111
- puts "Current buffer size: #{@current_buffer.size}"
112
- @current_buffer = nil if @position >= @current_buffer.size
113
- puts "current_buffer changed to #{@current_buffer}"
107
+
108
+ @position += @width
109
+ if @position >= @current_buffer.size
110
+ @current_buffer = nil
111
+ @position=0
112
+ end
114
113
  return record
115
114
  else
116
- record= @current_buffer.slice(@position,@width)
117
- puts "Getting subsequent record: #{record}"
115
+ record= @current_buffer.slice(@position,@width)
118
116
  @position += @width
119
- @current_buffer = nil if @position >= @current_buffer.size
120
- return record
117
+ if @position>=@current_buffer.size
118
+ @position=0
119
+ @current_buffer=nil
120
+ end
121
+ return record
121
122
  end
122
123
 
123
124
  else
124
- puts "At end of all chunks"
125
+
125
126
  nil
126
127
  end
127
128
  end
data/test/flrfile_test.rb CHANGED
@@ -108,6 +108,7 @@ customer_file.ranges=[(0..2)]
108
108
  records = []
109
109
  while !customer_file.finished?
110
110
  record = customer_file.next_record
111
+
111
112
  puts record.inspect
112
113
  records << record
113
114
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hflr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.0
5
+ version: 1.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Colin Davis