Class: SemanticPuppet::VersionRange::AbstractRange Private
- Defined in:
- lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #begin ⇒ Object private
- #end ⇒ Object private
- #eql?(other) ⇒ Boolean private
- #exclude_begin? ⇒ Boolean private
- #exclude_end? ⇒ Boolean private
- #include?(_) ⇒ Boolean private
-
#intersection(range) ⇒ AbastractRange?
private
Merge two ranges so that the result matches the intersection of all matching versions.
- #lower_bound? ⇒ Boolean private
-
#merge(other) ⇒ AbastractRange?
private
Merge two ranges so that the result matches the sum of all matching versions.
- #stable? ⇒ Boolean private
-
#test_prerelease?(_) ⇒ Boolean
private
Checks if this matcher accepts a prerelease with the same major, minor, patch triple as the given version.
- #upper_bound? ⇒ Boolean private
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
396 397 398 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 396 def ==(other) eql?(other) end |
#begin ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
376 377 378 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 376 def begin Version::MIN end |
#end ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
380 381 382 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 380 def end Version::MAX end |
#eql?(other) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
392 393 394 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 392 def eql?(other) other.class.eql?(self.class) end |
#exclude_begin? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
384 385 386 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 384 def exclude_begin? false end |
#exclude_end? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
388 389 390 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 388 def exclude_end? false end |
#include?(_) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
372 373 374 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 372 def include?(_) true end |
#intersection(range) ⇒ AbastractRange?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Merge two ranges so that the result matches the intersection of all matching versions.
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 414 def intersection(range) cmp = self.begin <=> range.end if cmp > 0 nil elsif cmp == 0 exclude_begin? || range.exclude_end? ? nil : EqRange.new(self.begin) else cmp = range.begin <=> self.end if cmp > 0 nil elsif cmp == 0 range.exclude_begin? || exclude_end? ? nil : EqRange.new(range.begin) else cmp = self.begin <=> range.begin min = if cmp < 0 range elsif cmp > 0 self else self.exclude_begin? ? self : range end cmp = self.end <=> range.end max = if cmp > 0 range elsif cmp < 0 self else self.exclude_end? ? self : range end if !max.upper_bound? min elsif !min.lower_bound? max else MinMaxRange.new(min, max) end end end end |
#lower_bound? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
400 401 402 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 400 def lower_bound? false end |
#merge(other) ⇒ AbastractRange?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Merge two ranges so that the result matches the sum of all matching versions. A merge is only possible when the ranges are either adjacent or have an overlap.
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 463 def merge(other) if include?(other.begin) || other.include?(self.begin) cmp = self.begin <=> other.begin if cmp < 0 min = self.begin excl_begin = exclude_begin? elsif cmp > 0 min = other.begin excl_begin = other.exclude_begin? else min = self.begin excl_begin = exclude_begin? && other.exclude_begin? end cmp = self.end <=> other.end if cmp > 0 max = self.end excl_end = self.exclude_end? elsif cmp < 0 max = other.end excl_end = other.exclude_end? else max = self.end excl_end = exclude_end && other.exclude_end? end MinMaxRange.create(excl_begin ? GtRange.new(min) : GtEqRange.new(min), excl_end ? LtRange.new(max) : LtEqRange.new(max)) elsif exclude_end? && !other.exclude_begin? && self.end == other.begin # Adjacent, self before other from_to(self, other) elsif other.exclude_end? && !exclude_begin? && other.end == self.begin # Adjacent, other before self from_to(other, self) elsif !exclude_end? && !other.exclude_begin? && self.end.next(:patch) == other.begin # Adjacent, self before other from_to(self, other) elsif !other.exclude_end? && !exclude_begin? && other.end.next(:patch) == self.begin # Adjacent, other before self from_to(other, self) else # No overlap nil end end |
#stable? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
516 517 518 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 516 def stable? false end |
#test_prerelease?(_) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks if this matcher accepts a prerelease with the same major, minor, patch triple as the given version. Only matchers where this has been explicitly stated will respond ‘true` to this method
512 513 514 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 512 def test_prerelease?(_) false end |
#upper_bound? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
404 405 406 |
# File 'lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb', line 404 def upper_bound? false end |