Class: Zipline::FakeStream

Inherits:
Object
  • Object
show all
Defined in:
lib/zipline/fake_stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ FakeStream

&block is the block that each gets from rails… we pass it strings to send data



6
7
8
9
# File 'lib/zipline/fake_stream.rb', line 6

def initialize(&block)
  @block = block
  @pos = 0
end

Instance Method Details

#<<(x) ⇒ Object



31
32
33
34
35
36
# File 'lib/zipline/fake_stream.rb', line 31

def <<(x)
  return if x.blank?
  throw "bad class #{x.class}" unless x.class == String
  @pos += x.bytesize
  @block.call(x.to_s)
end

#closeObject



38
39
40
# File 'lib/zipline/fake_stream.rb', line 38

def close
  nil
end

#posObject



15
16
17
# File 'lib/zipline/fake_stream.rb', line 15

def pos
  @pos
end

#pos=Object



23
24
25
# File 'lib/zipline/fake_stream.rb', line 23

def pos=
  throw :fit
end

#seekObject



19
20
21
# File 'lib/zipline/fake_stream.rb', line 19

def seek
  throw :fit
end

#tellObject



11
12
13
# File 'lib/zipline/fake_stream.rb', line 11

def tell
  @pos
end

#to_sObject



27
28
29
# File 'lib/zipline/fake_stream.rb', line 27

def to_s
  throw :fit
end