Class: Typhoeus::Form
- Inherits:
-
Object
- Object
- Typhoeus::Form
- Defined in:
- lib/typhoeus/form.rb,
ext/typhoeus/typhoeus_form.c
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#traversal ⇒ Object
readonly
Returns the value of attribute traversal.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Form
constructor
A new instance of Form.
- #multipart? ⇒ Boolean
- #process! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Form
Returns a new instance of Form.
8 9 10 |
# File 'lib/typhoeus/form.rb', line 8 def initialize(params = {}) @params = params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/typhoeus/form.rb', line 5 def params @params end |
#traversal ⇒ Object (readonly)
Returns the value of attribute traversal.
6 7 8 |
# File 'lib/typhoeus/form.rb', line 6 def traversal @traversal end |
Instance Method Details
#multipart? ⇒ Boolean
24 25 26 |
# File 'lib/typhoeus/form.rb', line 24 def multipart? !traversal[:files].empty? end |
#process! ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/typhoeus/form.rb', line 16 def process! # add params traversal[:params].each { |p| formadd_param(p[0], p[1]) } # add files traversal[:files].each { |file_args| formadd_file(*file_args) } end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/typhoeus/form.rb', line 28 def to_s Typhoeus::Utils.traversal_to_param_string(traversal, false) end |