Class: Evilution::Integration::Loading::SourceEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/loading/source_evaluator.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#call(source, file_path) ⇒ Object



9
10
11
12
13
14
# File 'lib/evilution/integration/loading/source_evaluator.rb', line 9

def call(source, file_path)
  absolute = File.expand_path(file_path)
  # rubocop:disable Security/Eval
  eval(source, TOPLEVEL_BINDING, absolute, 1)
  # rubocop:enable Security/Eval
end