Sha256: 66e686d125201fa51c3546bfc8458d8f503f7248898ef7489726b07f3fdb60c7
Contents?: true
Size: 729 Bytes
Versions: 2
Compression:
Stored size: 729 Bytes
Contents
module Troles::Common class Config module ValidRoles def add_valid_roles *roles valid_roles =valid_roles & roles end def valid_roles= *roles vrs = roles.flatten.map{|r| r.to_s.alpha_numeric}.map(&:to_sym).uniq raise ArgumentError, "The #{strategy} strategy can only accept 2 valid roles" if (vrs.size > 2) && strategy == :bit_one raise ArgumentError, "The role names you want to be valid are not valid role names. Must be alphanumeric, was: #{roles.flatten}" if vrs.empty? @valid_roles ||= vrs end def valid_roles raise "No valid roles defined" if !@valid_roles || @valid_roles.empty? @valid_roles end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
troles-0.5.1 | lib/troles/common/config/valid_roles.rb |
troles-0.5.0 | lib/troles/common/config/valid_roles.rb |