Class: Svelte::PathBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/svelte/path_builder.rb

Overview

Dynamically builds a module hierarchy on top of a given module based on the given Path

Class Method Summary collapse

Class Method Details

.build(path:, module_constant:) ⇒ Object

Builds a new Module hierarchy on top of module_constant If the path contains more than one part, modules will be built on top of each other.

Example: If the path is /store/inventory and the module_constant is Test, the resulting module hierarchy will be Test::Store::Inventory

Parameters:

  • path (Path)

    path to build

  • module_constant (Module)

    operation to build



17
18
19
20
# File 'lib/svelte/path_builder.rb', line 17

def build(path:, module_constant:)
  create_module_hierarchy(base_module: module_constant,
                          additional_modules: path.non_parameter_elements)
end