Sha256: 81a9a83c81abd42402b408e95035232abe38a23cb1d8e06375d1365503bf80be
Contents?: true
Size: 604 Bytes
Versions: 3
Compression:
Stored size: 604 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 self.player_match = Regexp.last_match FootballManager::Player.new(player_name, player_skill) end end def player_pattern /^\s*([a-zA-Z0-9]+\s?[a-zA-Z0-9]+)\s*,\s*([1-5]{1})\s*$/ end def player_name player_match.captures.first end def player_skill player_match.captures.last end end end end
Version data entries
3 entries across 3 versions & 1 rubygems