Class: Merb::Slices::Loader

Inherits:
BootLoader show all
Defined in:
merb-slices/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)

Methods inherited from BootLoader

after, after_app_loads, before, before_app_loads, before_master_shutdown, before_worker_shutdown, default_framework, finished?, inherited, move_klass

Class Method Details

+ (Array<String>) app_paths

App-level paths for all loaded slices.

Returns:

  • (Array<String>)

    Any app-level paths that have been loaded.



73
74
75
76
77
# File 'merb-slices/lib/merb-slices.rb', line 73

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

+ (Object) load_classes(*paths)

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

Parameters:

  • *paths (Array<String>)

    Array of paths to load classes from. May contain glob pattern.



51
52
53
# File 'merb-slices/lib/merb-slices.rb', line 51

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

+ (Object) load_file(file)

Load a single file and its requirements.

Parameters:

  • file (String)

    The file to load.



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

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

+ (Object) reload_router!

Reload the router. Takes Router#all_slices into account to load slices at runtime.



57
58
59
# File 'merb-slices/lib/merb-slices.rb', line 57

def reload_router!
  Merb::BootLoader::Router.reload!
end

+ (Object) remove_classes_in_file(file)

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

Parameters:

  • file (String)

    The file to remove.



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

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

+ (Object) run

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



28
29
30
31
# File 'merb-slices/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

+ (Array<String>) slice_paths

Slice-level paths for all loaded slices.

Returns:

  • (Array<String>)

    Any slice-level paths that have been loaded.



64
65
66
67
68
# File 'merb-slices/lib/merb-slices.rb', line 64

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