Class: Daru::IO::Base
- Inherits:
-
Object
- Object
- Daru::IO::Base
- Defined in:
- lib/daru/io/base.rb
Overview
Base IO Class that contains generic helper methods, to be used by other Importers::Base and Exporters::Base via inheritence
Direct Known Subclasses
Exporters::Avro, Exporters::Base, Exporters::CSV, Exporters::RDS, Exporters::SQL, Importers::Avro, Importers::Base, Importers::CSV, Importers::RDS, Importers::SQL
Instance Method Summary collapse
-
#optional_gem(dependency, version = nil, requires: nil, callback: self.class.name) ⇒ Object
Specifies and requires a gem, if the gem is present in the application environment.
Instance Method Details
#optional_gem(dependency, version = nil, requires: nil, callback: self.class.name) ⇒ Object
Specifies and requires a gem, if the gem is present in the application
environment. Else, raises LoadError
with meaningful message of which
dependency to install for which Daru-IO module.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/daru/io/base.rb', line 33 def optional_gem(dependency, version=nil, requires: nil, callback: self.class.name) gem dependency, version require requires || dependency rescue LoadError version = version.nil? ? '' : " #{version} version" raise LoadError, "Please install the #{dependency} gem#{version}, "\ "or add it to the Gemfile to use the #{callback} module." end |