Module: Sorbet::Eraser

Defined in:
lib/sorbet/eraser.rb,
lib/sorbet/eraser/cli.rb,
lib/sorbet/eraser/version.rb

Overview

This module contains the logic for erasing Sorbet type annotations from Ruby source code.

Defined Under Namespace

Modules: Patch Classes: CLI, Ranges

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Class Method Details

.erase(source) ⇒ Object

The is one of the two entrypoints to the module. This should be called with a string that contains Ruby source. It returns the modified Ruby source.



122
123
124
# File 'lib/sorbet/eraser.rb', line 122

def erase(source)
  erase_result(Prism.parse(source), source)
end

.erase_file(filepath) ⇒ Object

This is one of the two entrypoints to the module. This should be called with a filepath that points to a file that contains Ruby source. It returns the modified Ruby source.



129
130
131
# File 'lib/sorbet/eraser.rb', line 129

def erase_file(filepath)
  erase_result(Prism.parse_file(filepath), File.read(filepath))
end