Class: Merb::Slices::Loader
- Inherits:
-
BootLoader
- Object
- BootLoader
- Merb::Slices::Loader
- Defined in:
- lib/merb-slices.rb
Overview
Load Slice classes before the app’s classes are loaded.
This allows the application to override/merge any slice-level classes.
Class Method Summary collapse
-
.app_paths ⇒ Array[String]
App-level paths for all loaded slices.
-
.load_classes(*paths) ⇒ Object
Load classes from given paths - using path/glob pattern.
-
.load_file(file) ⇒ Object
Load a single file and its requirements.
-
.reload_router! ⇒ Object
Reload the router - takes all_slices into account to load slices at runtime.
-
.remove_classes_in_file(file) ⇒ Object
Remove a single file and the classes loaded by it from ObjectSpace.
-
.run ⇒ Object
Gather all slices from search path and gems and load their classes.
-
.slice_paths ⇒ Array[String]
Slice-level paths for all loaded slices.
Class Method Details
.app_paths ⇒ Array[String]
App-level paths for all loaded slices.
71 72 73 74 75 |
# File 'lib/merb-slices.rb', line 71 def app_paths paths = [] Merb::Slices.each_slice { |slice| paths += slice.collected_app_paths } paths end |
.load_classes(*paths) ⇒ Object
Load classes from given paths - using path/glob pattern.
50 51 52 |
# File 'lib/merb-slices.rb', line 50 def load_classes(*paths) Merb::BootLoader::LoadClasses.load_classes paths end |
.load_file(file) ⇒ Object
Load a single file and its requirements.
36 37 38 |
# File 'lib/merb-slices.rb', line 36 def load_file(file) Merb::BootLoader::LoadClasses.load_file file end |
.reload_router! ⇒ Object
Reload the router - takes all_slices into account to load slices at runtime.
55 56 57 |
# File 'lib/merb-slices.rb', line 55 def reload_router! Merb::BootLoader::Router.reload! end |
.remove_classes_in_file(file) ⇒ Object
Remove a single file and the classes loaded by it from ObjectSpace.
43 44 45 |
# File 'lib/merb-slices.rb', line 43 def remove_classes_in_file(file) Merb::BootLoader::LoadClasses.remove_classes_in_file file end |
.run ⇒ Object
Gather all slices from search path and gems and load their classes.
28 29 30 31 |
# File 'lib/merb-slices.rb', line 28 def run Merb::Slices.register_slices_from_search_path! if auto_register? Merb::Slices.each_slice { |slice| slice.load_slice } end |
.slice_paths ⇒ Array[String]
Slice-level paths for all loaded slices.
62 63 64 65 66 |
# File 'lib/merb-slices.rb', line 62 def slice_paths paths = [] Merb::Slices.each_slice { |slice| paths += slice.collected_slice_paths } paths end |