Class: OmniScrapper::Configuration
- Inherits:
-
Object
- Object
- OmniScrapper::Configuration
- Defined in:
- lib/omni_scrapper/configuration.rb
Constant Summary collapse
- SINGLE_OPTS =
%i[ do method ]
Instance Attribute Summary collapse
-
#anchors ⇒ Object
readonly
Returns the value of attribute anchors.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #field(name, options = {}) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 |
# File 'lib/omni_scrapper/configuration.rb', line 9 def initialize @fields = {} @anchors = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/omni_scrapper/configuration.rb', line 21 def method_missing(method_name, *args, &block) if args.empty? get_variable(method_name) else set_variable(method_name, args) end end |
Instance Attribute Details
#anchors ⇒ Object (readonly)
Returns the value of attribute anchors.
5 6 7 |
# File 'lib/omni_scrapper/configuration.rb', line 5 def anchors @anchors end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
5 6 7 |
# File 'lib/omni_scrapper/configuration.rb', line 5 def fields @fields end |
Instance Method Details
#field(name, options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/omni_scrapper/configuration.rb', line 14 def field(name, = {}) #validate_crawler_presence!(options) () # TODO: validate if field method is defined @fields[name] = end |