class IntermatScrape::WeightClass
Constants
- WEIGHT_CLASSES
Attributes
weight[RW]
wrestlers[RW]
Public Class Methods
all()
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 46 def self.all @@all end
create_weight_classes()
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 14 def self.create_weight_classes WEIGHT_CLASSES.each do |weight| new(weight) end @@all end
find_by_weight(weight)
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 25 def self.find_by_weight(weight) @@all.detect { |w| w.weight == weight } end
new(weight)
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 8 def initialize(weight) @weight = weight @wrestlers = [] @@all << self end
print_weights()
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 21 def self.print_weights puts WEIGHT_CLASSES end
Public Instance Methods
add_wrestler(wrestler)
click to toggle source
# File lib/intermat_scrape/weight_class.rb, line 29 def add_wrestler(wrestler) @wrestlers << wrestler wrestler.weight_class = self end
get_wrestler_by_rank(rank)
click to toggle source
TODO: move to Wrestler class?
# File lib/intermat_scrape/weight_class.rb, line 42 def get_wrestler_by_rank(rank) @wrestlers.detect { |w| w.rank == rank } end
print_wrestlers()
click to toggle source
TODO: move to Wrestler class?
# File lib/intermat_scrape/weight_class.rb, line 35 def print_wrestlers puts "" puts "Rankings: ".colorize(:light_cyan) @wrestlers.each.with_index { |w, _i| puts "#{w.rank}\t#{w.name}" } end