tkellem 0.9.0.beta8 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,48 +1,48 @@
1
1
  class BackwardsFileReader
2
- def self.scan(stream)
3
- scanner = new(stream)
4
- while line = scanner.readline
5
- break unless yield(line)
6
- end
7
- scanner.sync
8
- end
2
+ def self.scan(stream)
3
+ scanner = new(stream)
4
+ while line = scanner.readline
5
+ break unless yield(line)
6
+ end
7
+ scanner.sync
8
+ end
9
9
 
10
- def initialize(stream)
11
- @stream = stream
12
- @stream.seek 0, IO::SEEK_END
13
- @pos = @stream.pos
14
- @offset = 0
10
+ def initialize(stream)
11
+ @stream = stream
12
+ @stream.seek 0, IO::SEEK_END
13
+ @pos = @stream.pos
14
+ @offset = 0
15
15
 
16
- @read_size = [4096, @pos].min
17
- @line_buffer = []
18
- end
16
+ @read_size = [4096, @pos].min
17
+ @line_buffer = []
18
+ end
19
19
 
20
- def readline
21
- if @line_buffer.size > 2 || @pos == 0
22
- line = @line_buffer.pop
23
- if line
24
- @offset += line.length
25
- end
26
- return line
27
- end
20
+ def readline
21
+ if @line_buffer.size > 2 || @pos == 0
22
+ line = @line_buffer.pop
23
+ if line
24
+ @offset += line.length
25
+ end
26
+ return line
27
+ end
28
28
 
29
29
  @read_size = [@read_size, @pos].min
30
- @pos -= @read_size
31
- @stream.seek(@pos, IO::SEEK_SET)
32
- @offset = -@line_buffer.reduce(0) { |n,l| n + l.length }
30
+ @pos -= @read_size
31
+ @stream.seek(@pos, IO::SEEK_SET)
32
+ @offset = -@line_buffer.reduce(0) { |n,l| n + l.length }
33
33
 
34
- @line_buffer[0] = "#{@stream.read(@read_size)}#{@line_buffer[0]}"
35
- @line_buffer[0] = @line_buffer[0].scan(%r{.*\n})
36
- @line_buffer.flatten!
34
+ @line_buffer[0] = "#{@stream.read(@read_size)}#{@line_buffer[0]}"
35
+ @line_buffer[0] = @line_buffer[0].scan(%r{.*\n})
36
+ @line_buffer.flatten!
37
37
 
38
- readline
39
- end
38
+ readline
39
+ end
40
40
 
41
- def sync
42
- if @offset > 0
43
- @stream.seek(-@offset, IO::SEEK_CUR)
44
- end
45
- @offset = 0
46
- @stream
47
- end
41
+ def sync
42
+ if @offset > 0
43
+ @stream.seek(-@offset, IO::SEEK_CUR)
44
+ end
45
+ @offset = 0
46
+ @stream
47
+ end
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module Tkellem
2
- VERSION = "0.9.0.beta8"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkellem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.beta8
5
- prerelease: 6
4
+ version: 0.9.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Palmer
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-22 00:00:00.000000000 Z
12
+ date: 2013-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -179,13 +179,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 377877143913440914
182
+ hash: 267049175566363735
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
186
- - - ! '>'
186
+ - - ! '>='
187
187
  - !ruby/object:Gem::Version
188
- version: 1.3.1
188
+ version: '0'
189
+ segments:
190
+ - 0
191
+ hash: 267049175566363735
189
192
  requirements: []
190
193
  rubyforge_project:
191
194
  rubygems_version: 1.8.23