Sha256: 8dcf3069d2aeab84d12174da5e22a1b1cfd0ca5251777a5fc12db4f6db57d485

Contents?: true

Size: 379 Bytes

Versions: 7

Compression:

Stored size: 379 Bytes

Contents

require 'nokogiri'

Nokogiri::XML::Node.class_eval do
  def add_node(name)
    add_child Nokogiri::XML::Node.new(name, document)
  end
  
  # FIXME: remove switch. where is #from used with nodes?
  def self.from(data)
    case data
    when Nokogiri::XML::Node
      data
    when Nokogiri::XML::Document
      data.root
    else
      Nokogiri::XML(data).root
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
representable-0.9.3 lib/representable/nokogiri_extensions.rb
representable-0.9.2 lib/representable/nokogiri_extensions.rb
representable-0.9.1 lib/representable/nokogiri_extensions.rb
representable-0.9.0 lib/representable/nokogiri_extensions.rb
representable-0.0.2 lib/representable/nokogiri_extensions.rb
representable-0.0.1 lib/representable/nokogiri_extensions.rb
representable-0.0.1.alpha1 lib/representable/nokogiri_extensions.rb