Class: Nokogiri::XML::Node

Inherits:
Object show all
Defined in:
lib/effigy/nokogiri_ext.rb

Overview

Adds or updates the given attribute or attributes.

Instance Method Summary (collapse)

Instance Method Details

- (Object) append_fragment(html_to_append)

Parses and appends the given html fragment to the end of this node.

Parameters:

  • html_to_append (String)

    the html fragment that should be appended



17
18
19
20
21
# File 'lib/effigy/nokogiri_ext.rb', line 17

def append_fragment(html_to_append)
  fragment(html_to_append).children.each do |child|
    self << child
  end
end

- (Object) merge!(new_attributes)



9
10
11
12
13
# File 'lib/effigy/nokogiri_ext.rb', line 9

def merge!(new_attributes)
  new_attributes.each do |name, value|
    self[name.to_s] = value
  end
end