Class: TypePadTemplate::Form
- Inherits:
-
Object
- Object
- TypePadTemplate::Form
- Defined in:
- lib/type_pad_template/form.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(form_element) ⇒ Form
constructor
A new instance of Form.
- #method ⇒ Object
- #to_hash ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(form_element) ⇒ Form
Returns a new instance of Form.
3 4 5 6 |
# File 'lib/type_pad_template/form.rb', line 3 def initialize(form_element) @form_element = form_element @values = default_values end |
Instance Method Details
#[](key) ⇒ Object
8 9 10 |
# File 'lib/type_pad_template/form.rb', line 8 def [](key) @values[key.to_sym] end |
#[]=(key, value) ⇒ Object
12 13 14 |
# File 'lib/type_pad_template/form.rb', line 12 def []=(key, value) @values[key.to_sym] = value end |
#method ⇒ Object
20 21 22 |
# File 'lib/type_pad_template/form.rb', line 20 def method @form_element["method"].downcase.to_sym rescue :get end |
#to_hash ⇒ Object
16 17 18 |
# File 'lib/type_pad_template/form.rb', line 16 def to_hash @values.dup end |
#url ⇒ Object
24 25 26 |
# File 'lib/type_pad_template/form.rb', line 24 def url @form_element["action"] end |