Class: Core::Initializable::Initializer

Inherits:
Object
  • Object
show all
Defined in:
app/api/core/initializable.rb

Overview

rubocop:todo Style/Documentation

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ Initializer

Returns a new instance of Initializer.


5
6
7
# File 'app/api/core/initializable.rb', line 5

def initialize(owner)
  @owner = owner
end

Class Method Details

.delegate_to_owner(*names) ⇒ Object


17
18
19
20
# File 'app/api/core/initializable.rb', line 17

def delegate_to_owner(*names)
  names.push(to: :@owner)
  delegate(*names)
end

.delegated_attribute_writer(*names) ⇒ Object


10
11
12
13
14
15
# File 'app/api/core/initializable.rb', line 10

def delegated_attribute_writer(*names)
  names.each do |name|
    class_eval("def #{name}=(value) ; @owner.instance_variable_set(:@#{name}, value) ; end")
  end
  delegate_to_owner(*names)
end