Module: Representable::Config::InheritableArray

Included in:
Representable::Config
Defined in:
lib/representable/config.rb

Overview

DISCUSS: experimental. this will soon be moved to a separate gem

Instance Method Summary collapse

Instance Method Details

#inherit(parent) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/representable/config.rb', line 13

def inherit(parent)
  super

  parent.inheritable_arrays.keys.each do |k|
    inheritable_array(k).push *parent.inheritable_array(k).clone
  end
end

#inheritable_array(name) ⇒ Object



6
7
8
# File 'lib/representable/config.rb', line 6

def inheritable_array(name)
  inheritable_arrays[name] ||= []
end

#inheritable_arraysObject



9
10
11
# File 'lib/representable/config.rb', line 9

def inheritable_arrays
  @inheritable_arrays ||= {}
end