module Gem::Requirement::OrderIndependentComparison

def ==(other)

def ==(other)
  return unless Gem::Requirement === other
  if _requirements_sorted? && other._requirements_sorted?
    super
  else
    _with_sorted_requirements == other._with_sorted_requirements
  end
end

def _requirements_sorted?

def _requirements_sorted?
  return @_are_requirements_sorted if defined?(@_are_requirements_sorted)
  strings = as_list
  @_are_requirements_sorted = strings == strings.sort
end

def _with_sorted_requirements

def _with_sorted_requirements
  @_with_sorted_requirements ||= _requirements_sorted? ? self : self.class.new(as_list.sort)
end