Class: Mutineer::Project
- Inherits:
-
Object
- Object
- Mutineer::Project
- Defined in:
- lib/mutineer/project.rb
Overview
Subject discovery: parse each path and walk its AST for method definitions, tracking the enclosing class/module namespace.
Defined Under Namespace
Classes: SubjectVisitor
Class Method Summary collapse
-
.discover(paths, only: nil) ⇒ Array<Mutineer::Subject>
Discovers subjects from source paths.
Class Method Details
.discover(paths, only: nil) ⇒ Array<Mutineer::Subject>
Discovers subjects from source paths.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mutineer/project.rb', line 17 def self.discover(paths, only: nil) subjects = Array(paths).flat_map do |path| result = Parser.parse_file(path) visitor = SubjectVisitor.new(path) visitor.visit(result.value) visitor.promote_module_functions! visitor.subjects end only ? subjects.select { |s| s.qualified_name == only } : subjects end |