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) ⇒ Object #add(definition_class, name, **options, &block) ⇒ 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.

Builds and adds new definition

Overloads:

  • #add(definition_class, name, code = nil, **options) ⇒ Object

    Parameters:

    • code (String) (defaults to: nil)

      code to be evaluated when the method is ran

  • #add(definition_class, name, **options, &block) ⇒ Object

    Parameters:

    • block (Proc)

      block to be ran as method

Parameters:

  • name (String, Symbol)

    method name

  • options (Hash)

    Options of construction

Options Hash (**options):

  • cached (Boolean)

    Flag telling to create a method with cache

Returns:

  • MethodDefinitions



25
26
27
# File 'lib/sinclair/method_definitions.rb', line 25

def add(name, code = nil, **options, &block)
  definitions << MethodDefinition.from(name, code, **options, &block)
end