Method: Bundler::PubGrub::VersionRange#allows_all?

Defined in:
lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb

#allows_all?(other) ⇒ Boolean

Returns:

  • (Boolean)

320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb', line 320

def allows_all?(other)
  return true if other.empty?

  if other.is_a?(VersionUnion)
    return VersionUnion.new([self]).allows_all?(other)
  end

  return false if max && !other.max
  return false if min && !other.min

  if min
    case min <=> other.min
    when -1
    when 0
      return false if !include_min && other.include_min
    when 1
      return false
    end
  end

  if max
    case max <=> other.max
    when -1
      return false
    when 0
      return false if !include_max && other.include_max
    when 1
    end
  end

  true
end