Sha256: a2ef246dc0e18510b4e4ce6b10a12f8213df53fbdd3f2143c51ebe6013590704
Contents?: true
Size: 635 Bytes
Versions: 1
Compression:
Stored size: 635 Bytes
Contents
module FootballManager class PlayersCreator class << self attr_accessor :player_match def create_players(player_data) player_data.collect do |player| player =~ player_pattern if self.player_match = Regexp.last_match FootballManager::Player.new(name, skill) end end.compact end private def player_pattern /^\s*([a-zA-Z0-9]+\s?[a-zA-Z0-9]+)\s*,\s*([1-9]{1})\s*$/ end def name player_match.captures.first end def skill player_match.captures.last end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
football-manager-1.0.1 | lib/football-manager/players_creator.rb |