Module: Jetski::Autoloader
- Extended by:
- Autoloader
- Includes:
- Router::FilePathHelper
- Included in:
- Autoloader
- Defined in:
- lib/jetski/autoloader.rb
Instance Method Summary collapse
-
#call ⇒ Object
Responsibility is to load all models in app.
- #load_controllers ⇒ Object
Methods included from Router::FilePathHelper
#controller_file_paths, #model_file_paths
Instance Method Details
#call ⇒ Object
Responsibility is to load all models in app.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/jetski/autoloader.rb', line 6 def call model_file_paths.each do |path_to_model| require_relative path_to_model # Call method to define model attributes after loading model_name = path_to_model.split("app/models/")[-1] .gsub(".rb", "") .split("/") .map(&:capitalize) .join("::") end end |
#load_controllers ⇒ Object
18 19 20 21 22 |
# File 'lib/jetski/autoloader.rb', line 18 def load_controllers controller_file_paths.each do |file_path| require_relative file_path end end |