Class: Sinclair::MethodDefinitions Private

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

Enumerator holding all method definitions

Author:

  • darthjee

Instance Method Summary collapse

Instance Method Details

#add(definition_class, name, code = nil, **options) ⇒ Array<MethodDefinition> #add(definition_class, name, **options, &block) ⇒ Array<MethodDefinition> #add(type, *args, **options, &block) ⇒ Array<MethodDefinition>

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 and adds new definition

The type is decided based in the arguments

Overloads:

  • #add(definition_class, name, code = nil, **options) ⇒ Array<MethodDefinition>

    Parameters:

    • name (String, Symbol)

      method name

    • code (String) (defaults to: nil)

      code to be evaluated when the method is ran

    • options (Hash)

      Options of construction

    Options Hash (**options):

    • cached (Boolean)

      Flag telling to create a method with cache

  • #add(definition_class, name, **options, &block) ⇒ Array<MethodDefinition>

    Parameters:

    • name (String, Symbol)

      method name

    • options (Hash)

      Options of construction

    • block (Proc)

      block to be ran as method

    Options Hash (**options):

    • cached (Boolean)

      Flag telling to create a method with cache

  • #add(type, *args, **options, &block) ⇒ Array<MethodDefinition>

    Parameters:

    Options Hash (**options):

    • cached (Boolean)

      Flag telling to create a method with cache

Returns:

See Also:



43
44
45
# File 'lib/sinclair/method_definitions.rb', line 43

def add(*args, type: nil, **options, &block)
  definitions << MethodDefinition.for(type, *args, **options, &block)
end