class Capybara::Selector::XPathBuilder

def attribute_conditions(attributes)

def attribute_conditions(attributes)
  attributes.map do |attribute, value|
    case value
    when XPath::Expression
      XPath.attr(attribute)[value]
    when Regexp
      XPath.attr(attribute)[regexp_to_xpath_conditions(value)]
    when true
      XPath.attr(attribute)
    when false, nil
      !XPath.attr(attribute)
    else
      XPath.attr(attribute) == value.to_s
    end
  end.reduce(:&)
end