method
requirement
ruby latest stable - Class:
Gem::Dependency
requirement()public
What does this dependency require?
# File lib/rubygems/dependency.rb, line 120
def requirement
return @requirement if defined?(@requirement) and @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 Related methods
- Instance methods
- <=>
- ==
- ===
- =~
- hash
- inspect
- latest_version?
- match?
- matches_spec?
- matching_specs
- merge
- prerelease?
- pretty_print
- requirement
- requirements_list
- runtime?
- specific?
- to_s
- to_spec
- to_specs
- type
- Class methods
- new