Class: Core::Initializable::Initializer

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ Initializer


3
4
5
# File 'app/api/core/initializable.rb', line 3

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


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

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