method
validate_metadata
Ruby latest stable (v2_5_5)
-
0 notes -
Class: Specification
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
validate_metadata()
public
Hide source
# File lib/rubygems/specification.rb, line 2872 def validate_metadata url_validation_regex = %{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z} link_keys = %( bug_tracker_uri changelog_uri documentation_uri homepage_uri mailing_list_uri source_code_uri wiki_uri ) metadata.each do|key, value| if !key.kind_of?(String) raise Gem::InvalidSpecificationException, "metadata keys must be a String" end if key.size > 128 raise Gem::InvalidSpecificationException, "metadata key too large (#{key.size} > 128)" end if !value.kind_of?(String) raise Gem::InvalidSpecificationException, "metadata values must be a String" end if value.size > 1024 raise Gem::InvalidSpecificationException, "metadata value too large (#{value.size} > 1024)" end if link_keys.include? key if value !~ url_validation_regex raise Gem::InvalidSpecificationException, "metadata['#{key}'] has invalid link: #{value.inspect}" end end end end