class Sass::Selector::Simple

def unify(sels)

Raises:
  • (Sass::SyntaxError) - If this selector cannot be unified.

Returns:
  • (Array, nil) - A {SimpleSequence} {SimpleSequence#members members array}

Parameters:
  • sels (Array) -- A {SimpleSequence}'s {SimpleSequence#members members array}
def unify(sels)
  return sels if sels.any? {|sel2| eql?(sel2)}
  sels_with_ix = Haml::Util.enum_with_index(sels)
  _, i =
    if self.is_a?(Pseudo) || self.is_a?(Negation)
      sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && sels.last.type == :element}
    else
      sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) || sel.is_a?(Negation)}
    end
  return sels + [self] unless i
  return sels[0...i] + [self] + sels[i..-1]
end