Class: Relevance::Tarantula::Form

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, crawler, referrer) ⇒ Form

Returns a new instance of Form.



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

def initialize(tag, crawler, referrer)
  @tag, @crawler, @referrer = tag, crawler, referrer
end

Instance Attribute Details

#crawlerObject

Returns the value of attribute crawler.



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

def crawler
  @crawler
end

#referrerObject

Returns the value of attribute referrer.



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

def referrer
  @referrer
end

Instance Method Details

#actionObject



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

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

#methodObject



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

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

#rails_method_hackObject



22
23
24
# File 'lib/relevance/tarantula/form.rb', line 22

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