Module: Paperclip::Ext::Class::Hook

Defined in:
lib/dm-paperclip/ext/class.rb

Instance Method Summary collapse

Instance Method Details

#inherited(base) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dm-paperclip/ext/class.rb', line 26

def inherited(base)
  super

  attributes = ::Paperclip::Ext::Class.inheritable_attributes(self)
  new_attributes =
    if attributes.equal?(::Paperclip::Ext::Class::EMPTY_INHERITABLE_ATTRIBUTES)
      ::Paperclip::Ext::Class::EMPTY_INHERITABLE_ATTRIBUTES
    else
      attributes.inject({}) do |memo, (key, value)|
        memo[key] = ::Paperclip::Ext.try_dup(value.dup)
        memo
      end
    end

  base.instance_variable_set(::Paperclip::Ext::Class::IVar, new_attributes)
end