Class: SimpleCovMcp::Resolvers::ResultsetPathResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov_mcp/resolvers/resultset_path_resolver.rb

Constant Summary collapse

DEFAULT_CANDIDATES =
[
  '.resultset.json',
  'coverage/.resultset.json',
  'tmp/.resultset.json'
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(root: Dir.pwd, candidates: DEFAULT_CANDIDATES) ⇒ ResultsetPathResolver

Returns a new instance of ResultsetPathResolver.



14
15
16
17
# File 'lib/simplecov_mcp/resolvers/resultset_path_resolver.rb', line 14

def initialize(root: Dir.pwd, candidates: DEFAULT_CANDIDATES)
  @root = root
  @candidates = candidates
end

Instance Method Details

#find_resultset(resultset: nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/simplecov_mcp/resolvers/resultset_path_resolver.rb', line 19

def find_resultset(resultset: nil)
  if resultset && !resultset.empty?
    path = normalize_resultset_path(resultset)
    if (resolved = resolve_candidate(path, strict: true))
      return resolved
    end
  end

  resolve_fallback or raise_not_found_error
end