Module: Pincers::Extension::Labs

Included in:
Core::SearchContext
Defined in:
lib/pincers/extension/labs.rb

Instance Method Summary collapse

Instance Method Details

#readonly(&_block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pincers/extension/labs.rb', line 4

def readonly(&_block)
  nk_root = Pincers.for_nokogiri to_html

  unless root?
    nk_root = nk_root.css('body > *') # nokogiri will inject valid html structure around contents
  end

  if _block.nil?
    nk_root
  else
    _block.call(nk_root)
  end
end