Class: MockIO
- Inherits:
-
StringIO
- Object
- StringIO
- MockIO
- Defined in:
- lib/upload_progress/test/multipart_progress_testx.rb
Instance Method Summary collapse
-
#initialize(data = '', &block) ⇒ MockIO
constructor
A new instance of MockIO.
- #read(size) ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(data = '', &block) ⇒ MockIO
Returns a new instance of MockIO.
92 93 94 95 96 97 |
# File 'lib/upload_progress/test/multipart_progress_testx.rb', line 92 def initialize(data='', &block) test_logger.debug("MockIO inializing data: #{data[0..20]}") @block = block super(data) end |
Instance Method Details
#read(size) ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/upload_progress/test/multipart_progress_testx.rb', line 103 def read(size) test_logger.debug("MockIO getting data from super") data = super test_logger.debug("Calling read callback") @block.call test_logger.debug("Returning data: #{data.size}") data end |
#write(data) ⇒ Object
99 100 101 102 |
# File 'lib/upload_progress/test/multipart_progress_testx.rb', line 99 def write(data) test_logger.debug("MockIO write #{data.size} data: #{data[0..20]}") super end |