Class: Sinclair::MethodDefinition::CallDefinition Private

Inherits:
Sinclair::MethodDefinition 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

Constant Summary

Constants inherited from Sinclair::MethodDefinition

DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Sinclair::MethodDefinition

#name

Attributes included from OptionsParser

#options

Instance Method Summary collapse

Methods inherited from Sinclair::MethodDefinition

build_with, default_value, for, from

Methods included from OptionsParser

#options_object

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

#build(klass, type) ⇒ Symbol

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.

Builds the method defined

The method is built using Sinclair::MethodBuilder::CallMethodBuilder

Parameters:

Returns:

  • (Symbol)

    the name of the method built

See Also:



10
# File 'lib/sinclair/method_definition/call_definition.rb', line 10

build_with MethodBuilder::CallMethodBuilder

#code_blockProc

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