Module: Toy::Inheritance::ClassMethods

Defined in:
lib/toy/inheritance.rb

Constant Summary collapse

DuplicatedInstanceVariables =
[
  :attributes,
  :key_factory,
  :lists,
  :references,
  :adapter,
]

Instance Method Summary collapse

Instance Method Details

#inherited(subclass) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/toy/inheritance.rb', line 14

def inherited(subclass)
  DuplicatedInstanceVariables.each do |name|
    subclass.instance_variable_set("@#{name}", send(name).dup) if respond_to?(name)
  end

  subclass.attribute(:type, String, :default => subclass.name)

  super
end