Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Gem::Dependency#requirement
requirement
lib/rubygems/dependency.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems/dependency.rb, line 116
def requirement
return @requirement if defined?(@requirement) && @requirement
# @version_requirements and @version_requirement are legacy ivar
# names, and supported here because older gems need to keep
# working and Dependency doesn't implement marshal_dump and
# marshal_load. In a happier world, this would be an
# attr_accessor. The horrifying instance_variable_get you see
# below is also the legacy of some old restructurings.
#
# Note also that because of backwards compatibility (loading new
# gems in an old RubyGems installation), we can't add explicit
# marshaling to this class until we want to make a big
# break. Maybe 2.0.
#
# Children, define explicit marshal and unmarshal behavior for
# public classes. Marshal formats are part of your public API.
# REFACTOR: See above
if defined?(@version_requirement) && @version_requirement
version = @version_requirement.instance_variable_get :@version
@version_requirement = nil
@version_requirements = Gem::Requirement.new version
end
@requirement = @version_requirements if defined?(@version_requirements)
end
What does this dependency require?