class FifaRankings::Team
Attributes
captain[RW]
confederation[RW]
head_coach[RW]
most_caps[RW]
movement[RW]
name[RW]
points[RW]
rank[RW]
top_scorer[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/fifa_rankings/team.rb, line 35 def self.all @@all end
create_from_array(array)
click to toggle source
# File lib/fifa_rankings/team.rb, line 18 def self.create_from_array(array) # create Team instances from an array of hashes array.each {|team| self.new(team)} end
find_by_name(name)
click to toggle source
# File lib/fifa_rankings/team.rb, line 43 def self.find_by_name(name) self.all.detect {|team| team.name.downcase == name.downcase} end
find_by_rank(rank)
click to toggle source
# File lib/fifa_rankings/team.rb, line 39 def self.find_by_rank(rank) self.all.detect {|team| team.rank == rank} end
new(team_hash)
click to toggle source
# File lib/fifa_rankings/team.rb, line 7 def initialize(team_hash) team_hash.each do |k,v| self.send(("#{k}="),v) end @@all << self end
points_greater_than(number)
click to toggle source
# File lib/fifa_rankings/team.rb, line 14 def self.points_greater_than(number) self.all.select {|team| team.points > number} end
sort_by_rank()
click to toggle source
# File lib/fifa_rankings/team.rb, line 31 def self.sort_by_rank self.all.sort_by {|team| team.rank} end
Public Instance Methods
add_attributes(attributes_hash)
click to toggle source
# File lib/fifa_rankings/team.rb, line 23 def add_attributes(attributes_hash) # add attributes to Team instances from a hash for the detail view attributes_hash.each do |k,v| self.send(("#{k}="),v) end self end