module Navigation

Adds capability to navigate through posts pages.

Public Instance Methods

ascend() click to toggle source

Changes current Nokogiri element to its parent.

# File lib/blogbot/navigation.rb, line 32
def ascend
  if @current_element.ancestors.empty? == true # no more room to ascend
    puts 'At highest element.  Nothing left to ascend.'
  else
    @current_element = @current_element.parent
  end
end
auto_ascend() click to toggle source
# File lib/blogbot/navigation.rb, line 40
def auto_ascend
  ascend until see_multiple_links? == true
  @current_element
end
find_parent() click to toggle source

Returns parent of current Nokogiri element

# File lib/blogbot/navigation.rb, line 27
def find_parent
  @parent = @current_element.parent # one element higher, the div container
end
go_to_posts_page() click to toggle source

Navigates to posts page based off of store_posts_url.

# File lib/blogbot/navigation.rb, line 4
def go_to_posts_page
  find_posts_url
  store_posts_url
  @current_page = @posts_url.click
end
previous_page() click to toggle source

Navigates to previous Mechanize page.

# File lib/blogbot/navigation.rb, line 11
def previous_page
  @current_page = @agent.get(@agent.back['href'])
end