Class: PublishingPlatformNokodiff::HTMLFragment

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/publishing_platform_nokodiff/html_fragment.rb

Defined Under Namespace

Classes: InvalidHTMLError

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ HTMLFragment

Returns a new instance of HTMLFragment.



9
10
11
12
13
14
# File 'lib/publishing_platform_nokodiff/html_fragment.rb', line 9

def initialize(html)
  @fragment = Nokogiri::HTML.fragment(html)
  validate!
  remove_blank_nodes!
  remove_comments!
end