Sha256: b1d9c61d660ef73021cc3410e3dd1685a41a4947911e60f61a785985a22a370f
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Html2rss module ItemExtractors ## # Returns the HTML content of the specified element. # # Example HTML structure: # # <p>Lorem <b>ipsum</b> dolor ...</p> # # YAML usage example: # # selectors: # description: # selector: p # extractor: html # # Would return: # '<p>Lorem <b>ipsum</b> dolor ...</p>' # # Always ensure to sanitize the HTML during post-processing with # {AttributePostProcessors::SanitizeHtml}. class Html # The available options for the html extractor. Options = Struct.new('HtmlOptions', :selector, keyword_init: true) ## # Initializes the Html extractor. # # @param xml [Nokogiri::XML::Element] # @param options [Options] def initialize(xml, options) @element = ItemExtractors.element(xml, options.selector) end ## # Retrieves and returns the HTML content of the element. # # @return [String] The HTML content. def get @element.to_s end end end end
Version data entries
6 entries across 6 versions & 1 rubygems