Class: Mutant::Loader Private
- Inherits:
-
Object
- Object
- Mutant::Loader
- Defined in:
- lib/mutant/loader.rb
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.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- FROZEN_STRING_FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"# frozen_string_literal: true\n%s"
- VOID_VALUE_REGEXP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/\A[^:]+:\d+: void value expression/.freeze
Class Method Summary collapse
-
.call(*arguments) ⇒ Result
private
Call loader.
Instance Method Summary collapse
-
#call ⇒ Result
private
Call loader.
Class Method Details
.call(*arguments) ⇒ Result
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.
Call loader
27 28 29 |
# File 'lib/mutant/loader.rb', line 27 def self.call(*arguments) new(*arguments).call end |
Instance Method Details
#call ⇒ Result
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.
Call loader
One off the very few valid uses of eval ever.
rubocop:disable Metrics/MethodLength
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mutant/loader.rb', line 38 def call kernel.eval( FROZEN_STRING_FORMAT % source, binding, subject.source_path.to_s, subject.source_line ) rescue SyntaxError => exception # rubocop:disable Style/GuardClause if VOID_VALUE_REGEXP.match?(exception.) Result::VoidValue.instance else raise end else Result::Success.instance end |