Method: Nokogiri::XML::NodeSet#to_html

Defined in:
lib/nokogiri/xml/node_set.rb

#to_html(*args) ⇒ Object

Convert this NodeSet to HTML



341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/nokogiri/xml/node_set.rb', line 341

def to_html(*args)
  if Nokogiri.jruby?
    options = args.first.is_a?(Hash) ? args.shift : {}
    options[:save_with] ||= Node::SaveOptions::DEFAULT_HTML
    args.insert(0, options)
  end
  if empty?
    encoding = (args.first.is_a?(Hash) ? args.first[:encoding] : nil)
    encoding ||= document.encoding
    encoding.nil? ? "" : "".encode(encoding)
  else
    map { |x| x.to_html(*args) }.join
  end
end