Class Merb::Slices::Loader
In: merb-slices/lib/merb-slices.rb
Parent: Merb::BootLoader

Load Slice classes before the app‘s classes are loaded.

This allows the application to override/merge any slice-level classes.

Methods

Public Class methods

App-level paths for all loaded slices.

@return <Array[String]> Any app-level paths that have been loaded.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 70
70:       def app_paths
71:         paths = []
72:         Merb::Slices.each_slice { |slice| paths += slice.collected_app_paths }
73:         paths
74:       end

Load classes from given paths - using path/glob pattern.

@param *paths <Array> Array of paths to load classes from - may contain glob pattern

[Source]

    # File merb-slices/lib/merb-slices.rb, line 49
49:       def load_classes(*paths)
50:         Merb::BootLoader::LoadClasses.load_classes paths
51:       end

Load a single file and its requirements.

@param file<String> The file to load.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 35
35:       def load_file(file)
36:         Merb::BootLoader::LoadClasses.load_file file
37:       end

Reload the router - takes all_slices into account to load slices at runtime.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 54
54:       def reload_router!
55:         Merb::BootLoader::Router.reload!
56:       end

Remove a single file and the classes loaded by it from ObjectSpace.

@param file<String> The file to load.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 42
42:       def remove_classes_in_file(file)
43:         Merb::BootLoader::LoadClasses.remove_classes_in_file file
44:       end

Gather all slices from search path and gems and load their classes.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 27
27:       def run
28:         Merb::Slices.register_slices_from_search_path! if auto_register?
29:         Merb::Slices.each_slice { |slice| slice.load_slice }
30:       end

Slice-level paths for all loaded slices.

@return <Array[String]> Any slice-level paths that have been loaded.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 61
61:       def slice_paths
62:         paths = []
63:         Merb::Slices.each_slice { |slice| paths += slice.collected_slice_paths }
64:         paths
65:       end

Private Class methods

Whether slices from search paths should be registered automatically. Defaults to true if not explicitly set.

[Source]

    # File merb-slices/lib/merb-slices.rb, line 80
80:       def auto_register?
81:         Merb::Plugins.config[:merb_slices][:auto_register] || !Merb::Plugins.config[:merb_slices].key?(:auto_register)
82:       end

[Validate]