class Emcee::Node

Document is responsible for interacting with individual html nodes that make up the parsed document.

Public Class Methods

new(parser_node) click to toggle source
# File lib/emcee/node.rb, line 5
def initialize(parser_node)
  @parser_node = parser_node
end

Public Instance Methods

path() click to toggle source
# File lib/emcee/node.rb, line 9
def path
  href || src
end
remove() click to toggle source
# File lib/emcee/node.rb, line 13
def remove
  @parser_node.remove
end
replace(type, new_content) click to toggle source
# File lib/emcee/node.rb, line 17
def replace(type, new_content)
  new_node = Nokogiri::XML::Node.new(type, document)
  new_node.content = new_content
  @parser_node.replace(new_node)
end

Private Instance Methods

document() click to toggle source
# File lib/emcee/node.rb, line 33
def document
  @parser_node.document
end
href() click to toggle source
# File lib/emcee/node.rb, line 25
def href
  @parser_node.attribute("href")
end
src() click to toggle source
# File lib/emcee/node.rb, line 29
def src
  @parser_node.attribute("src")
end