Method: Spidr::Page#method_missing

Defined in:
lib/spidr/page.rb

#method_missing(name, *arguments, &block) ⇒ String (protected)

Provides transparent access to the values in #headers.

Parameters:

  • name (Symbol)

    The name of the missing method.

  • arguments (Array)

    Additional arguments for the missing method.

Returns:

  • (String)

    The missing method mapped to a header in #headers.

Raises:

  • (NoMethodError)

    The missing method did not map to a header in #headers.

[View source]

136
137
138
139
140
141
142
143
144
145
146
# File 'lib/spidr/page.rb', line 136

def method_missing(name,*arguments,&block)
  if (arguments.empty? && block.nil?)
    header_name = name.to_s.tr('_','-')

    if @response.key?(header_name)
      return @response[header_name]
    end
  end

  return super(name,*arguments,&block)
end