Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Gem::Specification.from_yaml
from_yaml(input)
lib/rubygems/specification.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems/specification.rb, line 1029
def self.from_yaml(input)
Gem.load_yaml
input = normalize_yaml_input input
spec = Gem::SafeYAML.safe_load input
if spec && spec.class == FalseClass
raise Gem::EndOfYAMLException
end
unless Gem::Specification === spec
raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
end
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
spec.reset_nil_attributes_to_default
spec.flatten_require_paths
spec
end
Special loader for YAML files. When a Specification object is loaded from a YAML file, it bypasses the normal Ruby object initialization routine (initialize). This method makes up for that and deals with gems of different ages.
input can be anything that YAML.load() accepts: String or IO.
See also
.find_in_unresolved_tree
.latest_spec_for
.find_in_unresolved
.latest_specs
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0