Module: HTTP::FormData::Readable
- Included in:
- Multipart, Multipart::Param, Part, Urlencoded
- Defined in:
- lib/http/form_data/readable.rb
Overview
Common behaviour for objects defined by an IO object.
Instance Method Summary collapse
-
#read(length = nil, outbuf = nil) ⇒ String?
Reads and returns part of IO content.
-
#rewind ⇒ void
Rewinds the IO to the beginning.
-
#size ⇒ Integer
Returns IO size in bytes.
-
#to_s ⇒ String
Returns IO content as a String.
Instance Method Details
#read(length = nil, outbuf = nil) ⇒ String?
Reads and returns part of IO content
31 32 33 |
# File 'lib/http/form_data/readable.rb', line 31 def read(length = nil, outbuf = nil) @io.read(length, outbuf) end |
#rewind ⇒ void
This method returns an undefined value.
Rewinds the IO to the beginning
53 54 55 |
# File 'lib/http/form_data/readable.rb', line 53 def rewind @io.rewind end |
#size ⇒ Integer
Returns IO size in bytes
42 43 44 |
# File 'lib/http/form_data/readable.rb', line 42 def size @io.size end |
#to_s ⇒ String
Returns IO content as a String
14 15 16 17 18 19 |
# File 'lib/http/form_data/readable.rb', line 14 def to_s rewind content = read #: String rewind content end |