Class: Inch::SourceParser

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/source_parser.rb

Overview

Parses the source tree

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(*args) ⇒ Object



4
5
6
7
8
# File 'lib/inch/source_parser.rb', line 4

def self.run(*args)
  parser = self.new
  parser.run(*args)
  parser
end

Instance Method Details

#all_objectsObject



10
11
12
13
14
# File 'lib/inch/source_parser.rb', line 10

def all_objects
  @all_objects ||= all_parsed_objects.map do |o|
    CodeObject::Proxy.for(o)
  end.sort_by(&:path)
end

#find_object(path) ⇒ Object Also known as: []



16
17
18
# File 'lib/inch/source_parser.rb', line 16

def find_object(path)
  all_objects.detect { |o| o.path == path }
end

#find_objects(path) ⇒ Object



21
22
23
# File 'lib/inch/source_parser.rb', line 21

def find_objects(path)
  all_objects.select { |o| o.path.start_with?(path) }
end

#run(paths, excluded = []) ⇒ Object



25
26
27
28
# File 'lib/inch/source_parser.rb', line 25

def run(paths, excluded = [])
  YARD::Registry.clear
  YARD.parse(paths, excluded)
end