Class: Html2rss::Selectors::ItemScope
- Inherits:
-
Data
- Object
- Data
- Html2rss::Selectors::ItemScope
- Defined in:
- lib/html2rss/selectors/item_scope.rb
Overview
Per-item extraction scope: owns the article node and page base_url for one
extraction pass. Channel hashes are injected (and cached) by Html2rss::Selectors.
Distinct from Context, which is the post-processor invocation bag (+options+).
Post-processor config is derived from #channel — not a parallel bag.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#scraper ⇒ Object
readonly
Returns the value of attribute scraper.
Instance Method Summary collapse
-
#context_for(options:) ⇒ Context
Builds a post-processor Context carrying this scope for nested selects.
-
#select(name) ⇒ Object+
Selects an attribute using this scope's item and base_url.
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url
11 12 13 |
# File 'lib/html2rss/selectors/item_scope.rb', line 11 def base_url @base_url end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel
11 12 13 |
# File 'lib/html2rss/selectors/item_scope.rb', line 11 def channel @channel end |
#item ⇒ Object (readonly)
Returns the value of attribute item
11 12 13 |
# File 'lib/html2rss/selectors/item_scope.rb', line 11 def item @item end |
#scraper ⇒ Object (readonly)
Returns the value of attribute scraper
11 12 13 |
# File 'lib/html2rss/selectors/item_scope.rb', line 11 def scraper @scraper end |
Instance Method Details
#context_for(options:) ⇒ Context
Builds a post-processor Context carrying this scope for nested selects.
25 26 27 |
# File 'lib/html2rss/selectors/item_scope.rb', line 25 def context_for(options:) Context.new(options:, item:, config: { channel: }, scraper:, item_scope: self) end |
#select(name) ⇒ Object+
Selects an attribute using this scope's item and base_url.
17 |
# File 'lib/html2rss/selectors/item_scope.rb', line 17 def select(name) = scraper.select_in_scope(name, self) |