Class: Benedictus::RailsLoader
- Inherits:
-
Object
- Object
- Benedictus::RailsLoader
- Defined in:
- lib/benedictus/rails_loader.rb
Constant Summary collapse
- ENV_VAR =
"BENEDICTUS_RAILS_ENV"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(start_dir: Dir.pwd) ⇒ RailsLoader
constructor
A new instance of RailsLoader.
- #load! ⇒ Object
Constructor Details
#initialize(start_dir: Dir.pwd) ⇒ RailsLoader
Returns a new instance of RailsLoader.
11 12 13 |
# File 'lib/benedictus/rails_loader.rb', line 11 def initialize(start_dir: Dir.pwd) @start_dir = File.(start_dir) end |
Class Method Details
.load!(start_dir: Dir.pwd) ⇒ Object
7 8 9 |
# File 'lib/benedictus/rails_loader.rb', line 7 def self.load!(start_dir: Dir.pwd) new(start_dir: start_dir).load! end |
Instance Method Details
#load! ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/benedictus/rails_loader.rb', line 15 def load! ENV["RAILS_ENV"] ||= ENV[ENV_VAR] || "development" env_path = locate_environment_rb require env_path env_path end |