Module: ReadmeScore::Util

Defined in:
lib/readme-score/util.rb

Class Method Summary collapse

Class Method Details

.to_noko(noko_or_html, copy = false) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/readme-score/util.rb', line 4

def to_noko(noko_or_html, copy = false)
  noko = noko_or_html
  if noko_or_html.is_a?(String)
    noko = Nokogiri::HTML.fragment(noko_or_html)
  elsif copy && noko_or_html.is_a?(Nokogiri::XML::Node)
    noko = Nokogiri::HTML.fragment(noko.to_s)
  end
  noko
end