Class: Sinclair::MethodBuilder::Base Private

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

Base class responsible for building methods

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, definition, type:) ⇒ Base

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 Base.

Parameters:

  • klass (Class)

    class to receive the method

  • definition (MethodDefinition)

    method defined

  • type (Symbol)

    type of method to be build

    • :instance instance methods

    • :class class methods



30
31
32
33
34
# File 'lib/sinclair/method_builder/base.rb', line 30

def initialize(klass, definition, type:)
  @klass = klass
  @definition = definition
  @type = type
end

Class Method Details

.build(klass, definition, 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.

Instantiate the class and build the method

Parameters:

  • klass (Class)

    class to receive the method

  • definition (MethodDefinition)

    method defined

  • type (Symbol)

    type of method to be build

    • :instance instance methods

    • :class class methods

Returns:

  • (Symbol)

    name of the method built

See Also:



21
22
23
# File 'lib/sinclair/method_builder/base.rb', line 21

def self.build(klass, definition, type:)
  new(klass, definition, type: type).build
end

Instance Method Details

#buildSymbol

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.

Build method (should be implemented in subclass)

Returns:

  • (Symbol)

    name of the method built

Raises:

  • NotImplementedError



41
42
43
# File 'lib/sinclair/method_builder/base.rb', line 41

def build
  raise NotImplementedError, 'Not implemented yet. this should be imlemented in subclasses'
end