Class: Initable::Builder

Inherits:
Module
  • Object
show all
Defined in:
lib/initable/builder.rb

Overview

Builds initialization behavior. :reek:TooManyInstanceVariables

Instance Method Summary collapse

Constructor Details

#initialize(*parameters, scope: :private, marameters: Marameters) ⇒ Builder

Returns a new instance of Builder.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/initable/builder.rb', line 9

def initialize *parameters, scope: :private, marameters: Marameters
  super()

  @parameters = marameters.for parameters
  @scope = scope
  @marameters = marameters
  @names = @parameters.names.compact
  @instance_module = Module.new.set_temporary_name "initable"

  freeze
end

Instance Method Details

#included(descendant) ⇒ Object



21
22
23
24
25
# File 'lib/initable/builder.rb', line 21

def included descendant
  super
  define_initialize descendant
  descendant.include instance_module
end