Class: Bundler::VersionRanges::ReqR::Endpoint

Inherits:
Struct
  • Object
show all
Defined in:
lib/bundler/version_ranges.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#inclusiveObject

Returns the value of attribute inclusive

Returns:

  • (Object)

    the current value of inclusive


8
9
10
# File 'lib/bundler/version_ranges.rb', line 8

def inclusive
  @inclusive
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version


8
9
10
# File 'lib/bundler/version_ranges.rb', line 8

def version
  @version
end

Instance Method Details

#<=>(other) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bundler/version_ranges.rb', line 9

def <=>(other)
  if version.equal?(INFINITY)
    return 0 if other.version.equal?(INFINITY)
    return 1
  elsif other.version.equal?(INFINITY)
    return -1
  end

  comp = version <=> other.version
  return comp unless comp.zero?

  if inclusive && !other.inclusive
    1
  elsif !inclusive && other.inclusive
    -1
  else
    0
  end
end