Class: Bundler::VersionRanges::ReqR
- Inherits:
 - 
      Struct
      
        
- Object
 - Struct
 - Bundler::VersionRanges::ReqR
 
 
- Defined in:
 - lib/bundler/version_ranges.rb,
lib/bundler/version_ranges.rb 
Defined Under Namespace
Classes: Endpoint
Constant Summary collapse
- INFINITY =
 begin inf = Object.new def inf.to_s "∞" end def inf.<=>(other) return 0 if other.equal?(self) 1 end inf.freeze end
- ZERO =
 Gem::Version.new("0.a")
- UNIVERSAL =
 ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
Instance Attribute Summary collapse
- 
  
    
      #left  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute left.
 - 
  
    
      #right  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute right.
 
Instance Method Summary collapse
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left
      6 7 8  | 
    
      # File 'lib/bundler/version_ranges.rb', line 6 def left @left end  | 
  
#right ⇒ Object
Returns the value of attribute right
      6 7 8  | 
    
      # File 'lib/bundler/version_ranges.rb', line 6 def right @right end  | 
  
Instance Method Details
#<=>(other) ⇒ Object
      66 67 68 69 70 71 72 73  | 
    
      # File 'lib/bundler/version_ranges.rb', line 66 def <=>(other) return -1 if other.equal?(INFINITY) comp = left <=> other.left return comp unless comp.zero? right <=> other.right end  | 
  
#cover?(v) ⇒ Boolean
      46 47 48 49 50 51 52 53 54 55 56  | 
    
      # File 'lib/bundler/version_ranges.rb', line 46 def cover?(v) return false if left.inclusive && left.version > v return false if !left.inclusive && left.version >= v if right.version != INFINITY return false if right.inclusive && right.version < v return false if !right.inclusive && right.version <= v end true end  | 
  
#empty? ⇒ Boolean
      58 59 60  | 
    
      # File 'lib/bundler/version_ranges.rb', line 58 def empty? left.version == right.version && !(left.inclusive && right.inclusive) end  | 
  
#single? ⇒ Boolean
      62 63 64  | 
    
      # File 'lib/bundler/version_ranges.rb', line 62 def single? left.version == right.version end  | 
  
#to_s ⇒ Object
      30 31 32  | 
    
      # File 'lib/bundler/version_ranges.rb', line 30 def to_s "#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}" end  |