Class: SemanticPuppet::VersionRange::MinMaxRange Private

Inherits:
AbstractRange show all
Defined in:
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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractRange

#==, #intersection, #merge

Constructor Details

#initialize(min, max) ⇒ MinMaxRange

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.

Returns a new instance of MinMaxRange.



543
544
545
546
# File 'lib/semantic_puppet/version_range.rb', line 543

def initialize(min, max)
  @min = min.is_a?(MinMaxRange) ? min.min : min
  @max = max.is_a?(MinMaxRange) ? max.max : max
end

Instance Attribute Details

#maxObject (readonly)

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.



537
538
539
# File 'lib/semantic_puppet/version_range.rb', line 537

def max
  @max
end

#minObject (readonly)

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.



537
538
539
# File 'lib/semantic_puppet/version_range.rb', line 537

def min
  @min
end

Class Method Details

.create(*ranges) ⇒ 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.



539
540
541
# File 'lib/semantic_puppet/version_range.rb', line 539

def self.create(*ranges)
  ranges.reduce { |memo, range| memo.intersection(range) }
end

Instance Method Details

#beginObject

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.



548
549
550
# File 'lib/semantic_puppet/version_range.rb', line 548

def begin
  @min.begin
end

#endObject

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.



552
553
554
# File 'lib/semantic_puppet/version_range.rb', line 552

def end
  @max.end
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.

Returns:

  • (Boolean)


564
565
566
# File 'lib/semantic_puppet/version_range.rb', line 564

def eql?(other)
  super && @min.eql?(other.min) && @max.eql?(other.max)
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.

Returns:

  • (Boolean)


556
557
558
# File 'lib/semantic_puppet/version_range.rb', line 556

def exclude_begin?
  @min.exclude_begin?
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.

Returns:

  • (Boolean)


560
561
562
# File 'lib/semantic_puppet/version_range.rb', line 560

def exclude_end?
  @max.exclude_end?
end

#hashObject

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.



568
569
570
# File 'lib/semantic_puppet/version_range.rb', line 568

def hash
  @min.hash ^ @max.hash
end

#include?(version) ⇒ 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.

Returns:

  • (Boolean)


572
573
574
# File 'lib/semantic_puppet/version_range.rb', line 572

def include?(version)
  @min.include?(version) && @max.include?(version)
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.

Returns:

  • (Boolean)


576
577
578
# File 'lib/semantic_puppet/version_range.rb', line 576

def lower_bound?
  @min.lower_bound?
end

#test_prerelease?(version) ⇒ 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.

Returns:

  • (Boolean)


584
585
586
# File 'lib/semantic_puppet/version_range.rb', line 584

def test_prerelease?(version)
  @min.test_prerelease?(version) || @max.test_prerelease?(version)
end

#to_sObject Also known as: inspect

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.



588
589
590
# File 'lib/semantic_puppet/version_range.rb', line 588

def to_s
  "#{@min} #{@max}"
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.

Returns:

  • (Boolean)


580
581
582
# File 'lib/semantic_puppet/version_range.rb', line 580

def upper_bound?
  @max.upper_bound?
end