Class: Hyde::Util::FormPart
- Inherits:
-
Struct
- Object
- Struct
- Hyde::Util::FormPart
- Defined in:
- lib/hyde/util/multipart.rb
Overview
Valid element of form data with headers
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Data received in the field through form data.
-
#filename ⇒ Object
readonly
Original name of the sent file.
-
#filetype ⇒ Object
readonly
MIME-type of the file.
-
#name ⇒ Object
readonly
name of the form part.
Instance Method Summary collapse
-
#file? ⇒ Boolean
Is this form part a file or plain data?.
-
#headers(value) ⇒ Object
headers recevied from form data.
-
#simplify ⇒ FormPart, String
If FormPart is not a file, simplify to string.
-
#tempfile(value) ⇒ Object
Temporary file for storing sent file data.
Instance Attribute Details
#data ⇒ Object (readonly)
Data received in the field through form data
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |
#filename ⇒ Object (readonly)
Original name of the sent file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |
#filetype ⇒ Object (readonly)
MIME-type of the file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |
#name ⇒ Object (readonly)
name of the form part
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |
Instance Method Details
#file? ⇒ Boolean
Is this form part a file or plain data?
21 22 23 |
# File 'lib/hyde/util/multipart.rb', line 21 def file? !tempfile.nil? end |
#headers=(value) ⇒ Object
headers recevied from form data
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |
#simplify ⇒ FormPart, String
If FormPart is not a file, simplify to string.
27 28 29 |
# File 'lib/hyde/util/multipart.rb', line 27 def simplify file? ? self : self.data end |
#tempfile=(value) ⇒ Object
Temporary file for storing sent file data.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hyde/util/multipart.rb', line 17 FormPart = Struct.new(:data, :name, :filename, :filetype, :tempfile, :headers) do # Is this form part a file or plain data? # @return [Boolean] def file? !tempfile.nil? end # If FormPart is not a file, simplify to string. # @return [FormPart, String] def simplify file? ? self : self.data end end |