Class: Anima::Builder

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/anima/builder.rb

Overview

Builds an anima infected class

Defined Under Namespace

Modules: Methods

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(anima, descendant) ⇒ undefined

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.

Initialize a new instance

Parameters:

  • anima (Anima)

    the anima instance used for infection

  • descendant (Class, Module)

    the object to infect



60
61
62
63
64
# File 'lib/anima/builder.rb', line 60

def initialize(anima, descendant)
  @anima      = anima
  @names      = anima.attribute_names
  @descendant = descendant
end

Class Method Details

.call(anima, descendant) ⇒ undefined

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.

Infect descendant with anima

Parameters:

  • anima (Anima)

    the anima instance used for infection

  • descendant (Class, Module)

    the object to infect

Returns:

  • (undefined)


45
46
47
# File 'lib/anima/builder.rb', line 45

def self.call(anima, descendant)
  new(anima, descendant).call
end

Instance Method Details

#callundefined

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.

Infect the instance with anima

Returns:

  • (undefined)


71
72
73
74
75
76
77
78
# File 'lib/anima/builder.rb', line 71

def call
  define_equalizer
  define_anima_method
  define_attribute_readers
  descendant_exec do
    include Methods
  end
end