123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/bundler/version_ranges.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#inclusive (rw)

[ GitHub ]

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

Endpoint = Struct.new(:version, :inclusive)

#version (rw)

[ GitHub ]

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

Endpoint = Struct.new(:version, :inclusive)

Instance Method Details

#<=>(other)

[ GitHub ]

  
# 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