Class: InOrOut::PlayerExtractor
- Inherits:
-
Object
- Object
- InOrOut::PlayerExtractor
- Defined in:
- lib/in_or_out/models/player_extractor.rb
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(match_data) ⇒ PlayerExtractor
constructor
A new instance of PlayerExtractor.
Constructor Details
#initialize(match_data) ⇒ PlayerExtractor
Returns a new instance of PlayerExtractor.
4 5 6 |
# File 'lib/in_or_out/models/player_extractor.rb', line 4 def initialize(match_data) @data = match_data end |
Instance Method Details
#extract ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/in_or_out/models/player_extractor.rb', line 8 def extract if ready? @data.css('.player').map do |player| build_player( extract_name(player), extract_team(player), extract_position(player), extract_number(player) ) end else [] end end |