Class: Tus::Input
- Inherits:
-
Object
- Object
- Tus::Input
- Defined in:
- lib/tus/input.rb
Instance Method Summary collapse
- #close ⇒ Object
- #eof? ⇒ Boolean
-
#initialize(input) ⇒ Input
constructor
A new instance of Input.
- #read(*args) ⇒ Object
- #rewind ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(input) ⇒ Input
Returns a new instance of Input.
3 4 5 6 |
# File 'lib/tus/input.rb', line 3 def initialize(input) @input = input @bytes_read = 0 end |
Instance Method Details
#close ⇒ Object
27 28 29 |
# File 'lib/tus/input.rb', line 27 def close # Rack input shouldn't be closed, we just support the interface end |
#eof? ⇒ Boolean
14 15 16 |
# File 'lib/tus/input.rb', line 14 def eof? @bytes_read == size end |
#read(*args) ⇒ Object
8 9 10 11 12 |
# File 'lib/tus/input.rb', line 8 def read(*args) result = @input.read(*args) @bytes_read += result.bytesize if result.is_a?(String) result end |
#rewind ⇒ Object
18 19 20 21 |
# File 'lib/tus/input.rb', line 18 def rewind @input.rewind @bytes_read = 0 end |
#size ⇒ Object
23 24 25 |
# File 'lib/tus/input.rb', line 23 def size @input.size end |