class OverwatchStats::Hero
Attributes
Public Class Methods
# File lib/hero.rb, line 47 def self.bastion bastion = self.scrapehero("http://masteroverwatch.com/heroes/15-bastion") bastion end
# File lib/hero.rb, line 52 def self.dva dva = self.scrapehero("http://masteroverwatch.com/heroes/22-d-va") dva end
# File lib/hero.rb, line 57 def self.genji genji = self.scrapehero("http://masteroverwatch.com/heroes/21-genji") genji end
# File lib/hero.rb, line 62 def self.hanzo hanzo = self.scrapehero("http://masteroverwatch.com/heroes/16-hanzo") hanzo end
# File lib/hero.rb, line 67 def self.junkrat junkray = self.scrapehero("http://masteroverwatch.com/heroes/2-junkrat") junkray end
# File lib/hero.rb, line 72 def self.lucio lucio = self.scrapehero("http://masteroverwatch.com/heroes/3-lucio") lucio end
# File lib/hero.rb, line 77 def self.mccree mccree = self.scrapehero("http://masteroverwatch.com/heroes/6-mccree") mccree end
# File lib/hero.rb, line 82 def self.mei mei = self.scrapehero("http://masteroverwatch.com/heroes/20-mei") mei end
# File lib/hero.rb, line 87 def self.mercy mercy = self.scrapehero("http://masteroverwatch.com/heroes/17-mercy") mercy end
# File lib/hero.rb, line 92 def self.pharah pharah = self.scrapehero("http://masteroverwatch.com/heroes/11-pharah") pharah end
# File lib/hero.rb, line 97 def self.reaper reaper = self.scrapehero("http://masteroverwatch.com/heroes/8-reaper") reaper end
# File lib/hero.rb, line 102 def self.reinhardt reinhardt = self.scrapehero("http://masteroverwatch.com/heroes/12-reinhardt") reinhardt end
# File lib/hero.rb, line 107 def self.roadhog roadhog = self.scrapehero("http://masteroverwatch.com/heroes/1-roadhog") roadhog end
@@urls = [“masteroverwatch.com/heroes/15-bastion”, “masteroverwatch.com/heroes/22-d-va”, “masteroverwatch.com/heroes/21-genji”, “masteroverwatch.com/heroes/16-hanzo”, “masteroverwatch.com/heroes/2-junkrat”, “masteroverwatch.com/heroes/3-lucio”, “masteroverwatch.com/heroes/6-mccree”, “masteroverwatch.com/heroes/20-mei”, “masteroverwatch.com/heroes/17-mercy”, “masteroverwatch.com/heroes/11-pharah”, “masteroverwatch.com/heroes/8-reaper”, “masteroverwatch.com/heroes/12-reinhardt”, “masteroverwatch.com/heroes/1-roadhog”, “masteroverwatch.com/heroes/4-soldier-76”, “masteroverwatch.com/heroes/13-symmetra”, “masteroverwatch.com/heroes/14-torbjorn”, “masteroverwatch.com/heroes/7-tracer”, “masteroverwatch.com/heroes/9-widowmaker”, “masteroverwatch.com/heroes/10-winston”, “masteroverwatch.com/heroes/5-zarya”, “masteroverwatch.com/heroes/18-zenyatta”]
# File lib/hero.rb, line 30 def self.scrapehero(page_url) doc = Nokogiri::HTML(open(page_url)) x = OverwatchStats::Hero.new x.name = doc.css("div.heroes-header-title h1").text x.lore = doc.css("div.heroes-lore p").text.gsub(".",". ") x.hp = doc.css("div.heroes-header-title span.stat-hp").text.strip + " HP" unless doc.css("div.heroes-header-title span.stat-hp").text.strip == "" x.ammo = doc.css("div.heroes-header-title span.stat-ammo").text.strip + " Ammo" unless doc.css("div.heroes-header-title span.stat-ammo").text.strip == "" x.abilities = [] doc.css("div.heroes-abilities-ability").each do |ability| ability_name = ability.css("div.ability-name").text ability_description = ability.css("div.ability-description").text x.abilities << {:ability_name => ability_name, :ability_description => ability_description} end x.role = doc.css("div.heroes-header-title span.stat-role").text x end
# File lib/hero.rb, line 112 def self.soldier76 soldier76 = self.scrapehero("http://masteroverwatch.com/heroes/4-soldier-76") soldier76 end
# File lib/hero.rb, line 117 def self.symmetra symmetra = self.scrapehero("http://masteroverwatch.com/heroes/13-symmetra") symmetra end
# File lib/hero.rb, line 122 def self.torbjorn torbjorn = self.scrapehero("http://masteroverwatch.com/heroes/14-torbjorn") torbjorn end
# File lib/hero.rb, line 127 def self.tracer tracer = self.scrapehero("http://masteroverwatch.com/heroes/7-tracer") tracer end
# File lib/hero.rb, line 132 def self.widowmaker widowmaker = self.scrapehero("http://masteroverwatch.com/heroes/9-widowmaker") widowmaker end
# File lib/hero.rb, line 137 def self.winston winston = self.scrapehero("http://masteroverwatch.com/heroes/10-winston") winston end
# File lib/hero.rb, line 142 def self.zarya zarya = self.scrapehero("http://masteroverwatch.com/heroes/5-zarya") zarya end
# File lib/hero.rb, line 147 def self.zenyatta zenyatta = self.scrapehero("http://masteroverwatch.com/heroes/18-zenyatta") zenyatta end