class Hawker::Drivers::Default

Attributes

response[R]

Public Class Methods

new(response) click to toggle source
# File lib/hawker/drivers/default.rb, line 6
def initialize(response)
  @response = response
end

Public Instance Methods

page_title() click to toggle source

The current page title

@return [String]

# File lib/hawker/drivers/default.rb, line 13
def page_title
  node_text html.at("head title")
end

Private Instance Methods

html() click to toggle source
# File lib/hawker/drivers/default.rb, line 21
def html
  @html ||= ::Nokogiri::HTML(response.body)
end
node_text(node) click to toggle source
# File lib/hawker/drivers/default.rb, line 25
def node_text(node)
  return if node.nil?

  node.text.strip
end