Class: Remi::Loader
- Inherits:
-
Object
- Object
- Remi::Loader
- Defined in:
- lib/remi/loader.rb
Overview
A loader is an object meant to load data into a some external system. This is a parent class meant to be inherited by child classes that define specific ways to load data.
Defined Under Namespace
Classes: DataFrame, LocalFile, None, Postgres, Salesforce, SftpFile, SubJob
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#autoload ⇒ Object
If autoload is set to true, then any loaders are called at the moment a dataframe is assigned to a target (e.g.,
my_target.df = some_dfwill call#loadon any loaders associated withmy_target). -
#fields ⇒ Remi::Fields
The fields defined in the context.
-
#initialize(*args, context: nil, logger: Remi::Settings.logger, **kargs, &block) ⇒ Loader
constructor
A new instance of Loader.
-
#load(data) ⇒ true
Any child classes need to define a load method that loads data from the given dataframe into the target system.
Constructor Details
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
12 13 14 |
# File 'lib/remi/loader.rb', line 12 def context @context end |
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/remi/loader.rb', line 12 def logger @logger end |
Instance Method Details
#autoload ⇒ Object
If autoload is set to true, then any loaders are called at the moment
a dataframe is assigned to a target (e.g., my_target.df = some_df will
call #load on any loaders associated with my_target).
25 26 27 |
# File 'lib/remi/loader.rb', line 25 def autoload false end |
#fields ⇒ Remi::Fields
Returns The fields defined in the context.
30 31 32 |
# File 'lib/remi/loader.rb', line 30 def fields context && context.respond_to?(:fields) ? context.fields : Remi::Fields.new({}) end |
#load(data) ⇒ true
Any child classes need to define a load method that loads data from the given dataframe into the target system.
18 19 20 |
# File 'lib/remi/loader.rb', line 18 def load(data) raise NoMethodError, "#{__method__} not defined for #{self.class.name}" end |