Class: Merb::Slices::Loader

Inherits:
BootLoader
  • Object
show all
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

Class Method Details

.app_pathsArray[String]

App-level paths for all loaded slices.

Returns:

  • (Array[String])

    Any app-level paths that have been loaded.



70
71
72
73
74
# File 'lib/merb-slices.rb', line 70

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.

Parameters:

  • *paths (Array)

    Array of paths to load classes from - may contain glob pattern



49
50
51
# File 'lib/merb-slices.rb', line 49

def load_classes(*paths)
  Merb::BootLoader::LoadClasses.load_classes paths
end

.load_file(file) ⇒ Object

Load a single file and its requirements.

Parameters:

  • file (String)

    The file to load.



35
36
37
# File 'lib/merb-slices.rb', line 35

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.



54
55
56
# File 'lib/merb-slices.rb', line 54

def reload_router!
  Merb::BootLoader::LoadClasses.reload_router!
end

.remove_file(file) ⇒ Object

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

Parameters:

  • file (String)

    The file to load.



42
43
44
# File 'lib/merb-slices.rb', line 42

def remove_file(file)
  Merb::BootLoader::LoadClasses.remove_file file
end

.runObject

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



27
28
29
30
# File 'lib/merb-slices.rb', line 27

def run
  Merb::Slices.register_slices_from_search_path! if auto_register?
  Merb::Slices.each_slice { |slice| slice.load_slice }
end

.slice_pathsArray[String]

Slice-level paths for all loaded slices.

Returns:

  • (Array[String])

    Any slice-level paths that have been loaded.



61
62
63
64
65
# File 'lib/merb-slices.rb', line 61

def slice_paths
  paths = []
  Merb::Slices.each_slice { |slice| paths += slice.collected_slice_paths }
  paths
end