Class: Relevance::Tarantula::Form

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/relevance/tarantula/form.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ Form

Returns a new instance of Form.



5
6
7
# File 'lib/relevance/tarantula/form.rb', line 5

def initialize(tag)
  @tag = tag
end

Instance Method Details

#actionObject



9
10
11
# File 'lib/relevance/tarantula/form.rb', line 9

def action
  @tag['action'].downcase
end

#methodObject



13
14
15
# File 'lib/relevance/tarantula/form.rb', line 13

def method
  (rails_method_hack or @tag['method'] or 'get').downcase
end

#rails_method_hackObject



17
18
19
# File 'lib/relevance/tarantula/form.rb', line 17

def rails_method_hack
  (tag = @tag.at('input[@name="_method"]')) && tag["value"]
end