class BnetScraper::Starcraft2::League

Attributes

account[RW]
bnet_id[RW]
division[RW]
href[RW]
id[RW]
name[RW]
random[RW]
season[RW]
size[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/bnet_scraper/starcraft2/league.rb, line 7
def initialize options = {}
  options.each_key do |key|
    self.send "#{key}=", options[key]
  end
end

Public Instance Methods

scrape() click to toggle source
# File lib/bnet_scraper/starcraft2/league.rb, line 46
def scrape
  scraper = LeagueScraper.new(url: href)
  scraper.scrape
  scraped_data = scraper.output
  scraped_data.each_key do |key|
    self.send "#{key}=", scraped_data[key]
  end
end
scrape_or_return(attribute) click to toggle source
# File lib/bnet_scraper/starcraft2/league.rb, line 37
def scrape_or_return attribute
  if self.instance_variable_get(attribute)
    return self.instance_variable_get(attribute)
  else
    scrape
    self.instance_variable_get(attribute)
  end
end