Class: Henitai::SubjectResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/henitai/subject_resolver.rb

Overview

Resolves AST subjects from Ruby source files.

The resolver walks Prism-translated ASTs and extracts method definitions with the namespace context established by surrounding module/class nodes.

Instance Method Summary collapse

Instance Method Details

#apply_pattern(subjects, pattern) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/henitai/subject_resolver.rb', line 18

def apply_pattern(subjects, pattern)
  pattern_subject = Subject.parse(pattern)

  Array(subjects).select do |subject|
    match_subject?(subject, pattern_subject)
  end
end

#resolve_from_files(paths) ⇒ Object



12
13
14
15
16
# File 'lib/henitai/subject_resolver.rb', line 12

def resolve_from_files(paths)
  Array(paths).flat_map do |path|
    resolve_from_file(path)
  end
end