Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Gem::Version#approximate_recommendation
() -> ::String
approximate_recommendation
lib/rubygems/version.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems/version.rb, line 342
def approximate_recommendation
segments = self.segments
segments.pop while segments.any? {|s| String === s }
segments.pop while segments.size > 2
segments.push 0 while segments.size < 2
recommendation = "~> #{segments.join(".")}"
recommendation += ".a" if prerelease?
recommendation
end
A recommended version for use with a ~> Requirement.
See also
#<=>
#bump
.nil_versions_are_discouraged!
#canonical_segments
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0