Class: Handlers::Inheritance

Inherits:
Base
  • Object
show all
Defined in:
lib/handlers/inheritance.rb

Instance Method Summary collapse

Methods inherited from Base

handle, #raise_error, #upper

Constructor Details

#initialize(subclass, klass) ⇒ Inheritance

Returns a new instance of Inheritance.



5
6
7
8
# File 'lib/handlers/inheritance.rb', line 5

def initialize(subclass, klass)
  @subclass = subclass
  @klass = klass
end

Instance Method Details

#handleObject



10
11
12
13
14
15
16
17
18
# File 'lib/handlers/inheritance.rb', line 10

def handle
  return nil if regular_inheritance?

  @klass.class_variables.each do |var_name|
    dsl_values = @subclass.class_variable_get(var_name)

    dsl_values[@subclass.name] = dsl_values[@klass.name].dup
  end
end