Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::SpecificationPolicy#validate_name
validate_name
lib/rubygems/specification_policy.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/specification_policy.rb, line 263
def validate_name
name = @specification.name
if !name.is_a?(String)
error "invalid value for attribute name: \"#{name.inspect}\" must be a string"
elsif !/[a-zA-Z]/.match?(name)
error "invalid value for attribute name: #{name.dump} must include at least one letter"
elsif !VALID_NAME_PATTERN.match?(name)
error "invalid value for attribute name: #{name.dump} can only include letters, numbers, dashes, and underscores"
elsif SPECIAL_CHARACTERS.match?(name)
error "invalid value for attribute name: #{name.dump} cannot begin with a period, dash, or underscore"
end
end
No documentation available
See also
#validate_metadata
#validate_nil_attributes
#validate_licenses_length
#validate_non_files
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0