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.



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

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

Instance Attribute Details

#crawlerObject

Returns the value of attribute crawler.



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

def crawler
  @crawler
end

#referrerObject

Returns the value of attribute referrer.



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

def referrer
  @referrer
end

Instance Method Details

#actionObject



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

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

#methodObject



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

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

#rails_method_hackObject



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

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