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, 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) ⇒ undefined
constructor
private
Initialize object.
Constructor Details
#initialize(location, types) ⇒ 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
27 28 29 30 31 32 33 |
# File 'lib/mutant/meta/example/dsl.rb', line 27 def initialize(location, types) @expected = [] @location = location @lvars = [] @source = nil @types = types end |
Class Method Details
.call(location, types, 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
16 17 18 19 20 |
# File 'lib/mutant/meta/example/dsl.rb', line 16 def self.call(location, types, block) instance = new(location, types) 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
57 58 59 |
# File 'lib/mutant/meta/example/dsl.rb', line 57 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
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mutant/meta/example/dsl.rb', line 41 def example fail 'source not defined' unless @source Example.new( expected: @expected, location: @location, lvars: @lvars, node: @node, original_source: @source, types: @types ) end |