Class: MOSAIK::Extractors::Structural::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaik/extractors/structural/parser.rb

Overview

Parser for Ruby code

Instance Method Summary collapse

Instance Method Details

#parse(file, tree) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mosaik/extractors/structural/parser.rb', line 12

def parse(file, tree)
  debug "Parsing file: #{file}"

  # Parse Abstract Syntax Tree
  ast = ::Parser::Ruby33
    .parse_file(file)

  # Process AST to extract constants, methods and references
  Processor
    .new(tree)
    .process(ast)
end