Class: Html2rss::Selectors::Extractors::Static
- Inherits:
-
Object
- Object
- Html2rss::Selectors::Extractors::Static
- Defined in:
- lib/html2rss/selectors/extractors/static.rb
Overview
Returns a static value provided in the options.
Example usage in YAML:
selectors:
byline:
extractor: static
static: Foobar
Would return:
'Foobar'
Defined Under Namespace
Classes: Options
Constant Summary collapse
- OPTION_TYPES =
Config-facing option types (excluding shared selector fields supplied at runtime).
{ static: String }.freeze
- DESCRIPTION =
JSON Schema description exported via
schema_doc. 'Return a fixed value from sibling selector option `static` (no DOM read).'- EXAMPLES =
Example extractor name values for JSON Schema
examples. [ 'static' ].freeze
Class Method Summary collapse
-
.schema_doc ⇒ Hash{Symbol => Object}
JSON Schema fragment for this extractor name.
Instance Method Summary collapse
-
#get ⇒ String, Symbol
Retrieves and returns the static value.
-
#initialize(_xml, options) ⇒ Static
constructor
Initializes the Static extractor.
Constructor Details
#initialize(_xml, options) ⇒ Static
Initializes the Static extractor.
42 43 44 |
# File 'lib/html2rss/selectors/extractors/static.rb', line 42 def initialize(_xml, ) @options = end |
Class Method Details
.schema_doc ⇒ Hash{Symbol => Object}
Returns JSON Schema fragment for this extractor name.
34 |
# File 'lib/html2rss/selectors/extractors/static.rb', line 34 def self.schema_doc = SchemaDoc.for_extractor(name: :static, klass: self) |
Instance Method Details
#get ⇒ String, Symbol
Retrieves and returns the static value.
50 51 52 |
# File 'lib/html2rss/selectors/extractors/static.rb', line 50 def get @options.static end |