free_mutant/lib/mutant/loader.rb
Markus Schirp 8335cccafb Fix YARD summary line
* Reduce redunrant 'Return' prefix on summaries
* Improve summary line to reflect the semantics of operation better
2015-07-03 15:21:39 +00:00

42 lines
747 B
Ruby

module Mutant
# Base class for code loaders
class Loader
include AbstractType, Concord.new(:root, :subject), Procto.call
# Eval based loader
class Eval < self
# Call loader
#
# @return [undefined]
#
# One off the very few valid uses of eval
#
# rubocop:disable Lint/Eval
#
# @api private
def call
eval(
source,
TOPLEVEL_BINDING,
subject.source_path.to_s,
subject.source_line
)
self
end
private
# Source generated from AST
#
# @return [String]
#
# @api private
def source
Unparser.unparse(root)
end
end # Eval
end # Loader
end # Mutant