Class: Control

Inherits:
Reflection show all
Defined in:
lib/Control.rb

Instance Attribute Summary

Attributes inherited from Reflection

#clone

Instance Method Summary collapse

Methods inherited from Reflection

#initialize, #randomize, #result

Constructor Details

This class inherits a constructor from Reflection

Instance Method Details

#reflect(*args) ⇒ Hash

Reflect on a method.

Creates a shadow execution stack.

Parameters:

  • method (Symbol)

    The name of the method.

  • *args (Args)

    The method arguments.

Returns:

  • (Hash)

    A reflection hash.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/Control.rb', line 24

def reflect(*args)

  # Create metadata for each argument.
  @inputs = MetaBuilder.create_many(args)

  # Action method with new arguments.
  begin
    output = @clone.send(@method, *args)
  # When fail.
  rescue StandardError => message
    @status = :fail
    @message = message
  # When pass.
  else
    @status = :pass
  end

end