Class: Ace::Search::Atoms::SearchPathResolver
- Inherits:
-
Object
- Object
- Ace::Search::Atoms::SearchPathResolver
- Defined in:
- lib/ace/search/atoms/search_path_resolver.rb
Overview
Resolve search path using 4-step priority algorithm
Priority order:
-
Explicit path argument (if provided)
-
PROJECT_ROOT_PATH environment variable
-
Project root detection via ProjectRootFinder
-
Fallback to current directory
Class Method Summary collapse
-
.resolve(explicit_path = nil) ⇒ String
Resolve search path with 4-step priority.
Instance Method Summary collapse
-
#resolve(explicit_path = nil) ⇒ String
Resolve search path with 4-step priority.
Class Method Details
.resolve(explicit_path = nil) ⇒ String
Resolve search path with 4-step priority
20 21 22 |
# File 'lib/ace/search/atoms/search_path_resolver.rb', line 20 def self.resolve(explicit_path = nil) new.resolve(explicit_path) end |
Instance Method Details
#resolve(explicit_path = nil) ⇒ String
Resolve search path with 4-step priority
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ace/search/atoms/search_path_resolver.rb', line 28 def resolve(explicit_path = nil) # Step 1: Use explicit path if provided (and not whitespace-only) return explicit_path if explicit_path && !explicit_path.strip.empty? # Step 2: Check PROJECT_ROOT_PATH environment variable project_root_env = env_project_root if project_root_env && !project_root_env.empty? # We validate the ENV var path to prevent a misconfigured environment # from causing silent failures. We then fall back gracefully. # (Explicit paths are trusted and not validated here) return project_root_env if valid_path?(project_root_env) end # Step 3: Detect project root using ProjectRootFinder project_root = find_project_root return project_root if project_root # Step 4: Fallback to current directory "." end |