Class: Dry::Component::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/component/loader.rb

Defined Under Namespace

Classes: Component

Constant Summary collapse

PATH_SEPARATOR =
'/'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Loader

Returns a new instance of Loader.



48
49
50
51
52
# File 'lib/dry/component/loader.rb', line 48

def initialize(config)
  @default_namespace = config.default_namespace
  @namespace_separator = config.namespace_separator
  @path_separator = PATH_SEPARATOR
end

Instance Attribute Details

#default_namespaceObject (readonly)

Returns the value of attribute default_namespace.



44
45
46
# File 'lib/dry/component/loader.rb', line 44

def default_namespace
  @default_namespace
end

#namespace_separatorObject (readonly)

Returns the value of attribute namespace_separator.



45
46
47
# File 'lib/dry/component/loader.rb', line 45

def namespace_separator
  @namespace_separator
end

#path_separatorObject (readonly)

Returns the value of attribute path_separator.



46
47
48
# File 'lib/dry/component/loader.rb', line 46

def path_separator
  @path_separator
end

Instance Method Details

#load(component_path) ⇒ Object



54
55
56
# File 'lib/dry/component/loader.rb', line 54

def load(component_path)
  Component.new(self, component_path)
end