Class: Fetcher::Base
- Inherits:
-
Object
- Object
- Fetcher::Base
- Defined in:
- lib/bas/fetcher/base.rb
Overview
The Fetcher::Base class serves as the foundation for implementing specific data fetchers within the Fetcher module. Operating as an interface, this class defines essential attributes and methods, providing a blueprint for creating custom fetchers tailored to different data sources.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#fetch ⇒ Object
A method meant to fetch data from an specific source depending on the implementation.
-
#initialize(config) ⇒ Base
constructor
Initializes the fetcher with essential configuration parameters.
Constructor Details
#initialize(config) ⇒ Base
Initializes the fetcher with essential configuration parameters.
16 17 18 |
# File 'lib/bas/fetcher/base.rb', line 16 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/bas/fetcher/base.rb', line 12 def config @config end |
Instance Method Details
#fetch ⇒ Object
A method meant to fetch data from an specific source depending on the implementation. Must be overridden by subclasses, with specific logic based on the use case.
raises Domain::Exceptions::FunctionNotImplemented
when missing implementation.
26 27 28 |
# File 'lib/bas/fetcher/base.rb', line 26 def fetch raise Domain::Exceptions::FunctionNotImplemented end |