Class: ExtraLoop::ExtractionEnvironment
- Inherits:
-
Object
- Object
- ExtraLoop::ExtractionEnvironment
- Defined in:
- lib/extraloop/extraction_environment.rb
Overview
This class acts as a virtual environment within which Hook handlers and extractors run (through #run)
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#scraper ⇒ Object
readonly
Returns the value of attribute scraper.
Instance Method Summary collapse
-
#initialize(scraper = nil, document = nil, records = nil) ⇒ ExtractionEnvironment
constructor
A new instance of ExtractionEnvironment.
- #run(*arguments, &block) ⇒ Object
Constructor Details
#initialize(scraper = nil, document = nil, records = nil) ⇒ ExtractionEnvironment
Returns a new instance of ExtractionEnvironment.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/extraloop/extraction_environment.rb', line 9 def initialize(scraper=nil, document=nil, records=nil) if scraper @options = scraper. @results = scraper.results @scraper = scraper end @document = document @records = records end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
6 7 8 |
# File 'lib/extraloop/extraction_environment.rb', line 6 def document @document end |
#scraper ⇒ Object (readonly)
Returns the value of attribute scraper.
7 8 9 |
# File 'lib/extraloop/extraction_environment.rb', line 7 def scraper @scraper end |
Instance Method Details
#run(*arguments, &block) ⇒ Object
20 21 22 |
# File 'lib/extraloop/extraction_environment.rb', line 20 def run(*arguments, &block) self.instance_exec(*arguments, &block) end |