Class: Keiyaku::Upload
- Inherits:
-
Object
- Object
- Keiyaku::Upload
- Defined in:
- lib/keiyaku/runtime.rb,
sig/keiyaku.rbs
Overview
One file in a multipart/form-data body.
Keiyaku::Upload.new(File.open("kaya.png"))
Keiyaku::Upload.new(bytes, filename: "kaya.png", content_type: "image/png")
An IO passed on its own is wrapped in one of these, so the common case needs no ceremony. The content type is not guessed from the extension — a wrong one is worse than the honest default.
Instance Attribute Summary collapse
-
#content_type ⇒ String
readonly
Returns the value of attribute content_type.
-
#filename ⇒ String
readonly
Returns the value of attribute filename.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io, filename: nil, content_type: nil) ⇒ Upload
constructor
A new instance of Upload.
- #read ⇒ String
Constructor Details
#initialize(io, filename: nil, content_type: nil) ⇒ Upload
Returns a new instance of Upload.
129 |
# File 'sig/keiyaku.rbs', line 129
def initialize: (untyped io, ?filename: String?, ?content_type: String?) -> void
|
Instance Attribute Details
#content_type ⇒ String (readonly)
Returns the value of attribute content_type.
127 128 129 |
# File 'sig/keiyaku.rbs', line 127 def content_type @content_type end |
#filename ⇒ String (readonly)
Returns the value of attribute filename.
126 127 128 |
# File 'sig/keiyaku.rbs', line 126 def filename @filename end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
125 126 127 |
# File 'sig/keiyaku.rbs', line 125 def io @io end |
Instance Method Details
#read ⇒ String
130 |
# File 'sig/keiyaku.rbs', line 130
def read: () -> String
|