Sha256: 34b2e9f639909d2d156a83ec09ea6e4e82f70570e462d8cc216b41796e9f4642
Contents?: true
Size: 388 Bytes
Versions: 9
Compression:
Stored size: 388 Bytes
Contents
module FootballManager class Player attr_accessor :name, :skill def initialize(name, skill) @name = name if valid?(name, 'name') @skill = skill.to_i if valid?(skill, 'skill') end def valid?(attribute, attribute_name) attribute.nil? ? fail(FootballManager::PlayerError, "You cannot create a player with no #{attribute_name}") : true end end end
Version data entries
9 entries across 9 versions & 1 rubygems