Class: FootStats::Live::Team

Inherits:
Object
  • Object
show all
Defined in:
lib/foot_stats/live_team.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Team

Returns a new instance of Team.



7
8
9
10
11
12
13
14
15
# File 'lib/foot_stats/live_team.rb', line 7

def initialize(params)
  @coach     = params['@Tecnico']
  @full_name = params['@Nome']
  @source_id = params['@Id']

  parse_cards   params['Cartoes']
  parse_goals   params['Gols']
  parse_players params['Escalacao']
end

Instance Attribute Details

#cardsObject (readonly)

Returns the value of attribute cards.



5
6
7
# File 'lib/foot_stats/live_team.rb', line 5

def cards
  @cards
end

#coachObject (readonly)

Returns the value of attribute coach.



4
5
6
# File 'lib/foot_stats/live_team.rb', line 4

def coach
  @coach
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



4
5
6
# File 'lib/foot_stats/live_team.rb', line 4

def full_name
  @full_name
end

#goalsObject (readonly)

Returns the value of attribute goals.



5
6
7
# File 'lib/foot_stats/live_team.rb', line 5

def goals
  @goals
end

#playersObject (readonly)

Returns the value of attribute players.



5
6
7
# File 'lib/foot_stats/live_team.rb', line 5

def players
  @players
end

#source_idObject (readonly)

Returns the value of attribute source_id.



4
5
6
# File 'lib/foot_stats/live_team.rb', line 4

def source_id
  @source_id
end

Instance Method Details

#initial_playersObject



17
18
19
# File 'lib/foot_stats/live_team.rb', line 17

def initial_players
  players.find_all{ |player| !player.substituted? }
end

#substituted_playersObject



21
22
23
# File 'lib/foot_stats/live_team.rb', line 21

def substituted_players
  players.find_all{ |player| player.substituted? }
end