class Summoner

Attributes

champions[RW]
lp[RW]
name[RW]
rank[RW]
url_name[RW]
win_ratio[RW]

Public Class Methods

all() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 11
def self.all
  @@all
end
find_create_by_name(name) click to toggle source
# File lib/LeagueHelper/summoner.rb, line 42
def self.find_create_by_name(name)
  self.all.detect{|summoner| summoner.name == name} || self.new(name)
end
new(summoner_name) click to toggle source
# File lib/LeagueHelper/summoner.rb, line 4
def initialize(summoner_name)
  @name = summoner_name
  @url_name = @name.split(" ").join("+")
  @champions = []
  @@all << self
end

Public Instance Methods

best_champs() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 28
def best_champs
  @champions.sort {|a, b| b.my_winpercent <=> a.my_winpercent}
end
champ_builds() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 32
def champ_builds
  LolScraper.champion_build(@champions)
  @champions.each {|champ| champ.build.delete_at(6) }
  @champions
end
champ_find(name) click to toggle source
# File lib/LeagueHelper/summoner.rb, line 38
def champ_find(name)
  @champions.detect{|champ| champ.name.downcase == "#{name.downcase}"}
end
my_champs() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 24
def my_champs
  @champions.each {|champ| puts "#{champ.name}"}
end
my_winpercent() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 15
def my_winpercent
  Scraper.new.champion_win(@champions)
end
stats() click to toggle source
# File lib/LeagueHelper/summoner.rb, line 19
def stats
  puts "Summoner: #{@name}"
  puts "Rank: #{@rank} with #{@lp}"
end