Class: Mutant::Parser Private

Inherits:
Object
  • Object
show all
Includes:
Unparser::Adamantium
Defined in:
lib/mutant/parser.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An AST Parser

Instance Method Summary collapse

Constructor Details

#initializeundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object



11
12
13
# File 'lib/mutant/parser.rb', line 11

def initialize
  @cache = {}
end

Instance Method Details

#call(path) ⇒ AST::Node

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parse path into AST

Parameters:

  • path (Pathname)

Returns:

  • (AST::Node)


20
21
22
# File 'lib/mutant/parser.rb', line 20

def call(path)
  @cache[path.expand_path] ||= parse(path.read)
end