Class: Html2rss::ItemExtractors::Static

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/item_extractors/static.rb

Overview

Returns a static value provided in the options.

Example usage in YAML:

selectors:
  author:
    extractor: static
    static: Foobar

Would return:

'Foobar'

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(_xml, options) ⇒ Static

Initializes the Static extractor.

Parameters:

  • _xml (nil, Nokogiri::XML::Element)

    Unused parameter for compatibility with other extractors.

  • options (Options)

    Options containing the static value.



26
27
28
# File 'lib/html2rss/item_extractors/static.rb', line 26

def initialize(_xml, options)
  @options = options
end

Instance Method Details

#getString, Symbol

Retrieves and returns the static value.

Returns:

  • (String, Symbol)

    The static value provided in options.



34
35
36
# File 'lib/html2rss/item_extractors/static.rb', line 34

def get
  @options.static
end