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

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
# File 'app/api/core/initializable.rb', line 15

def delegate_to_owner(*names)
  delegate(*names, to: :@owner)
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