Class: Komponent::ComponentPathResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/komponent/component_path_resolver.rb

Defined Under Namespace

Classes: MissingComponentError

Instance Method Summary collapse

Instance Method Details

#resolve(component_name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/komponent/component_path_resolver.rb', line 5

def resolve(component_name)
  root_path = component_paths.find do |path|
    path_has_component?(path, component_name)
  end

  if root_path.nil?
    raise ComponentPathResolver::MissingComponentError.new(
      component_name,
      component_paths,
    )
  end

  root_path.join(*component_name)
end