class BeerList::Establishments::HappyGnome

Constants

BOTTLES
DRAFTS

Attributes

url[RW]

Public Class Methods

new() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 9
def initialize
  @url = DRAFTS
end

Public Instance Methods

get_list() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 13
def get_list
  get_draft_list
  get_bottle_list
end

Private Instance Methods

base_list() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 37
def base_list
  @happy_gnome = page.search('p').map(&:text)
end
get_bottle_list() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 31
def get_bottle_list
  self.url  = BOTTLES
  self.page = BeerList.scraper.visit self
  @beers    += get_the_list
end
get_draft_list() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 26
def get_draft_list
  @beers = []
  @beers += get_the_list
end
get_the_list() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 20
def get_the_list
  base_list
  match_before_paren
  reject_empty
end
match_before_paren() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 41
def match_before_paren
  @happy_gnome = @happy_gnome.map{ |b| b.match(/\(/); $` }
end
reject_empty() click to toggle source
# File lib/beer_list/establishments/happy_gnome.rb, line 45
def reject_empty
  @happy_gnome = @happy_gnome.reject(&:nil?).map(&:strip)
end