Class: Zipline::FakeStream
- Inherits:
-
Object
- Object
- Zipline::FakeStream
- Defined in:
- lib/zipline/fake_stream.rb
Instance Method Summary collapse
- #<<(x) ⇒ Object
- #close ⇒ Object
-
#initialize(&block) ⇒ FakeStream
constructor
&block is the block that each gets from rails…
- #pos ⇒ Object
- #pos= ⇒ Object
- #seek ⇒ Object
- #tell ⇒ Object
- #to_s ⇒ Object
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 |
#close ⇒ Object
38 39 40 |
# File 'lib/zipline/fake_stream.rb', line 38 def close nil end |
#pos ⇒ Object
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 |
#seek ⇒ Object
19 20 21 |
# File 'lib/zipline/fake_stream.rb', line 19 def seek throw :fit end |
#tell ⇒ Object
11 12 13 |
# File 'lib/zipline/fake_stream.rb', line 11 def tell @pos end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/zipline/fake_stream.rb', line 27 def to_s throw :fit end |