Method: OldApiResource::Base.inherited

Defined in:
lib/old_api_resource/base.rb

.inherited(klass) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/old_api_resource/base.rb', line 24

def inherited(klass)
  # Call the methods of the superclass to make sure inheritable accessors and the like have been inherited
  super
  # Now we need to define the inherited method on the klass that's doing the inheriting
  # it calls super which will allow the chaining effect we need
  klass.instance_eval <<-EOE, __FILE__, __LINE__ + 1
    def inherited(klass)
      super
    end
  EOE
  # Now we can make a call to setup the inheriting klass with its attributes
  klass.set_class_attributes_upon_load unless klass.instance_variable_defined?(:@class_data)
  klass.instance_variable_set(:@class_data, true)
  # we want to reset element_name and collection_name for the inherited class
  true
end