Class: SemverDialects::Boundary

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/semver_dialects/boundary.rb

Overview

rubocop:todo Style/Documentation

Direct Known Subclasses

AboveAll, BelowAll

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(semver) ⇒ Boundary

Returns a new instance of Boundary.



12
13
14
# File 'lib/semver_dialects/boundary.rb', line 12

def initialize(semver)
  @semver = semver
end

Instance Attribute Details

#semverObject

Returns the value of attribute semver.



10
11
12
# File 'lib/semver_dialects/boundary.rb', line 10

def semver
  @semver
end

Instance Method Details

#<=>(other) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/semver_dialects/boundary.rb', line 20

def <=>(other)
  return nil unless other.is_a?(Boundary)
  return -1 if other.instance_of?(AboveAll)
  return 1 if other.instance_of?(BelowAll)

  semver <=> other.semver
end

#is_initial_version?Boolean

rubocop:todo Naming/PredicateName

Returns:

  • (Boolean)


28
29
30
# File 'lib/semver_dialects/boundary.rb', line 28

def is_initial_version? # rubocop:todo Naming/PredicateName
  @semver.is_zero?
end

#to_sObject



16
17
18
# File 'lib/semver_dialects/boundary.rb', line 16

def to_s
  @semver.to_s
end