Class: Resourceful::AbstractFormData
- Defined in:
- lib/resourceful/abstract_form_data.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#add(name, value) ⇒ Object
Add a name-value pair to this form data representation.
-
#initialize(contents = {}) ⇒ AbstractFormData
constructor
A new instance of AbstractFormData.
-
#rewind ⇒ Object
Resets representation so that #read can be called again.
Constructor Details
#initialize(contents = {}) ⇒ AbstractFormData
Returns a new instance of AbstractFormData.
3 4 5 6 7 8 9 |
# File 'lib/resourceful/abstract_form_data.rb', line 3 def initialize(contents = {}) @form_data = [] contents.each do |k,v| add(k, v) end end |
Instance Method Details
#add(name, value) ⇒ Object
Add a name-value pair to this form data representation.
15 16 17 |
# File 'lib/resourceful/abstract_form_data.rb', line 15 def add(name, value) form_data << [name.to_s, value] end |
#rewind ⇒ Object
Resets representation so that #read can be called again.
Form data representations do not need to be rewound so this is a no-op.
24 25 |
# File 'lib/resourceful/abstract_form_data.rb', line 24 def rewind end |