Class: Evilution::Integration::Loading::SourceEvaluator Private
- Inherits:
-
Object
- Object
- Evilution::Integration::Loading::SourceEvaluator
- Defined in:
- lib/evilution/integration/loading/source_evaluator.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.
Evaluate source with FILE set to the absolute original path so that
require_relative and __dir__ resolve against the real source tree, where
sibling files actually exist.
Trust boundary: source is never user-supplied. It is always the original
on-disk source from a file the user already pointed Evilution at, with
byte-level mutations applied by AST::SourceSurgeon. The only difference
between this eval path and a plain require of the same file is that we
substitute the mutated bytes — the privilege level is identical.
Instance Method Summary collapse
Instance Method Details
#call(source, file_path) ⇒ Object
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.
15 16 17 18 19 20 21 |
# File 'lib/evilution/integration/loading/source_evaluator.rb', line 15 def call(source, file_path) # When the isolator has chdir'd into a per-mutation sandbox (EV-wqxu / # GH #1278), anchor the eval __FILE__ against PROJECT_ROOT so siblings # `require_relative` can find each other from the real source tree. absolute = File.(file_path, Evilution.project_base_dir) eval(source, TOPLEVEL_BINDING, absolute, 1) end |