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


15
16
17
18
# File 'app/api/core/initializable.rb', line 15

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

.delegated_attribute_writer(*names) ⇒ Object


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

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