Class: Sinclair::MethodDefinition::CallDefinition Private

Inherits:
MethodDefinition
  • Object
show all
Defined in:
lib/sinclair/method_definition/call_definition.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.

Define a call of method to e done within the class

Author:

  • darthjee

Instance Method Summary collapse

Constructor Details

#initialize(method_name, *arguments) ⇒ CallDefinition

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.

Returns a new instance of CallDefinition.

Parameters:

  • method_name (Symbol) —

    method to be called

  • arguments (Array<Symbol,String>) —

    parameters to be passed as arguments to the call



15
16
17
18
# File 'lib/sinclair/method_definition/call_definition.rb', line 15

def initialize(method_name, *arguments)
  @arguments = arguments
  super(method_name)
end

Instance Method Details

#code_block ⇒ Proc

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.

Block to be evaluated by the class when adding methods

The block will be a call from method_name passing arguments as arguments

Returns:

  • (Proc)


28
29
30
31
32
33
34
35
# File 'lib/sinclair/method_definition/call_definition.rb', line 28

def code_block
  method_name = name
  args = arguments

  proc do
    send(method_name, *args)
  end
end