class Nokogiri::CSS::Node

:nodoc:

def accept(visitor)

Accept +visitor+
def accept(visitor)
  visitor.send(:"visit_#{type.to_s.downcase}", self)
end

def find_by_type(types)

Find a node by type using +types+
def find_by_type(types)
  matches = []
  matches << self if to_type == types
  @value.each do |v|
    matches += v.find_by_type(types) if v.respond_to?(:find_by_type)
  end
  matches
end

def initialize(type, value)

Create a new Node with +type+ and +value+
def initialize(type, value)
  @type = type
  @value = value
end

def to_a

Convert to array
def to_a
  [@type] + @value.map { |n| n.respond_to?(:to_a) ? n.to_a : [n] }
end

def to_type

Convert to_type
def to_type
  [@type] + @value.filter_map do |n|
    n.to_type if n.respond_to?(:to_type)
  end
end

def to_xpath(prefix, visitor)

Convert this CSS node to xpath with +prefix+ using +visitor+
##
def to_xpath(prefix, visitor)
  prefix = "." if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil?
  prefix + visitor.accept(self)
end