Class: Mutant::Meta::Example::DSL Private
- Inherits:
-
Object
- Object
- Mutant::Meta::Example::DSL
- Includes:
- AST::Sexp
- Defined in:
- lib/mutant/meta/example/dsl.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.
Example DSL
Class Method Summary collapse
-
.call(location:, types:, operators:, block:) ⇒ Example
private
Run DSL on block.
Instance Method Summary collapse
-
#declare_lvar(name) ⇒ Object
private
Declare a local variable.
-
#example ⇒ Example
private
Example captured by DSL.
-
#initialize(location, types, operators) ⇒ undefined
constructor
private
Initialize object.
Constructor Details
#initialize(location, types, operators) ⇒ undefined
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.
Initialize object
28 29 30 31 32 33 34 |
# File 'lib/mutant/meta/example/dsl.rb', line 28 def initialize(location, types, operators) @expected = [] @location = location @lvars = [] @operators = operators @types = types end |
Class Method Details
.call(location:, types:, operators:, block:) ⇒ Example
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.
Run DSL on block
18 19 20 21 22 |
# File 'lib/mutant/meta/example/dsl.rb', line 18 def self.call(location:, types:, operators:, block:) # rubocop:disable Metrics/ParameterLists instance = new(location, types, operators) instance.instance_eval(&block) instance.example end |
Instance Method Details
#declare_lvar(name) ⇒ 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.
Declare a local variable
59 60 61 |
# File 'lib/mutant/meta/example/dsl.rb', line 59 def declare_lvar(name) @lvars << name end |
#example ⇒ Example
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.
Example captured by DSL
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mutant/meta/example/dsl.rb', line 42 def example fail 'source not defined' unless @source Example.new( expected: @expected, location: @location, lvars: @lvars, node: @node, operators: @operators, original_source: @source, types: @types ) end |