Module: Memorization

Included in:
Blogbot
Defined in:
lib/blogbot/memorization.rb

Overview

Adds capability to memorize things such as URLs, etc. Most variables are stored here.

Instance Method Summary collapse

Instance Method Details

#find_posts_urlObject

Searches page for link that says Articles or Blog.



5
6
7
8
# File 'lib/blogbot/memorization.rb', line 5

def find_posts_url
  @article_link = @current_page.link_with(text: /Articles/)
  @blog_link = @current_page.link_with(text: /Blog/)
end

#store_indicatorObject

Sets search indicator to whatever had ‘Popular’ in its text.



22
23
24
# File 'lib/blogbot/memorization.rb', line 22

def store_indicator
  @indicator = @current_page.search("[text()*='Popular']").first
end

#store_posts_urlObject

Memorize posts_url found by find_posts.



11
12
13
14
15
16
17
18
19
# File 'lib/blogbot/memorization.rb', line 11

def store_posts_url
  @posts_url =
    case
    when @article_link.nil? == false
      @article_link
    when @blog_link.nil? == false
      @blog_link
    end
end