Method: Acunetix::Scan#method_missing

Defined in:
lib/acunetix/scan.rb

#method_missing(method, *args) ⇒ Object

This method is invoked by Ruby when a method that is not defined in this instance is called.

In our case we inspect the @method@ parameter and try to find the corresponding <tag/> element inside the ./Scan child.



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/acunetix/scan.rb', line 43

def method_missing(method, *args)
  # We could remove this check and return nil for any non-recognized tag.
  # The problem would be that it would make tricky to debug problems with
  # typos. For instance: <>.potr would return nil instead of raising an
  # exception
  super and return unless SUPPORTED_TAGS.include?(method)

  if tag = xml.at_xpath("./#{tag_name_for_method(method)}")
    tag.text
  else
    nil
  end
end