Sha256: edab23e3fcf71629df4b330333d23e782ce8b8aded9b949e8838fdc2ecc9416f
Contents?: true
Size: 679 Bytes
Versions: 16
Compression:
Stored size: 679 Bytes
Contents
class String def to_xhtml css = nil node = Nokogiri::HTML(self) unless css node else nodes = node.css(css) raise "Elements for '#{css}' CSS query not found!" if nodes.size < 1 raise "Found more than one elment for '#{css}' CSS query!" if nodes.size > 1 nodes.first end end end require 'nokogiri' ::Nokogiri::XML::Node.class_eval do def should_be_fuzzy_equal_to attributes node_attributes = {} attributes.each do |k, v| nv = if k.to_s == 'content' self.content else self[k.to_s] end node_attributes[k] = nv end node_attributes.should == attributes end end
Version data entries
16 entries across 16 versions & 1 rubygems