Class: RecordLoader::Adapter::Basic
- Inherits:
-
Object
- Object
- RecordLoader::Adapter::Basic
- Defined in:
- lib/record_loader/adapter/basic.rb
Overview
A very basic RecordLoader::Adapter which provides limited logging functionality, environment is extracted from RACK_ENV
Instance Attribute Summary collapse
-
#logger ⇒ Logger
readonly
The configured logger instance.
Instance Method Summary collapse
-
#development? ⇒ Boolean
Returns whether we are running in a development environment Determined by looking at RACK_ENV.
-
#initialize(logger: Logger.new(STDOUT)) ⇒ Basic
constructor
Create a new Basic.
-
#transaction ⇒ Void
Impliments the RecordLoader::Adapter interface by providing a transaction method.
Constructor Details
#initialize(logger: Logger.new(STDOUT)) ⇒ Basic
Create a new RecordLoader::Adapter::Basic. Can pass in a pre-existing logger is required.
22 23 24 |
# File 'lib/record_loader/adapter/basic.rb', line 22 def initialize(logger: Logger.new(STDOUT)) @logger = logger end |
Instance Attribute Details
#logger ⇒ Logger (readonly)
Returns The configured logger instance.
13 14 15 |
# File 'lib/record_loader/adapter/basic.rb', line 13 def logger @logger end |
Instance Method Details
#development? ⇒ Boolean
Returns whether we are running in a development environment Determined by looking at RACK_ENV
43 44 45 |
# File 'lib/record_loader/adapter/basic.rb', line 43 def development? ENV.fetch('RACK_ENV', 'unknown').casecmp?('development') end |
#transaction ⇒ Void
Impliments the RecordLoader::Adapter interface by providing a transaction method. Used by Base.create!. This implimentation yields immediately, but otherwise performs no other functions.
33 34 35 |
# File 'lib/record_loader/adapter/basic.rb', line 33 def transaction yield end |