Module: RipperPlus

Defined in:
lib/ripper-plus/ripper-plus.rb,
lib/ripper-plus/version.rb,
lib/ripper-plus/scope_stack.rb,
lib/ripper-plus/transformer.rb

Overview

Top-level module for Ripper Plus. Provides global methods for getting a RipperPlus AST for a given input program.

Defined Under Namespace

Modules: Transformer, Version Classes: DuplicateArgumentError, DynamicConstantError, InvalidArgumentError, LHSError, ScopeStack, SyntaxError

Constant Summary collapse

DEFAULT_OPTS =
{:in_place => false}

Class Method Summary collapse

Class Method Details

.for_ripper_ast(tree, opts = {}) ⇒ Object

Transforms the provided Ripper AST into a RipperPlus AST.



11
12
13
14
# File 'lib/ripper-plus/ripper-plus.rb', line 11

def self.for_ripper_ast(tree, opts={})
  opts = DEFAULT_OPTS.merge(opts)
  Transformer.transform(tree, opts)
end

.sexp(text, opts = {}) ⇒ Object

Parses the given Ruby code into a RipperPlus AST.



6
7
8
# File 'lib/ripper-plus/ripper-plus.rb', line 6

def self.sexp(text, opts={})
  for_ripper_ast(Ripper.sexp(text), opts.merge(:in_place => true))
end