Module: DuckRecord::Core::ClassMethods

Defined in:
lib/duck_record/core.rb

Instance Method Summary collapse

Instance Method Details

#allocateObject



20
21
22
23
# File 'lib/duck_record/core.rb', line 20

def allocate
  define_attribute_methods
  super
end

#generated_association_methodsObject



33
34
35
36
37
38
39
40
41
# File 'lib/duck_record/core.rb', line 33

def generated_association_methods
  @generated_association_methods ||= begin
    mod = const_set(:GeneratedAssociationMethods, Module.new)
    private_constant :GeneratedAssociationMethods
    include mod

    mod
  end
end

#inherited(child_class) ⇒ Object

:nodoc:



25
26
27
# File 'lib/duck_record/core.rb', line 25

def inherited(child_class) # :nodoc:
  super
end

#initialize_generated_modulesObject

:nodoc:



29
30
31
# File 'lib/duck_record/core.rb', line 29

def initialize_generated_modules # :nodoc:
  generated_association_methods
end

#inspectObject

Returns a string like ‘Post(id:integer, title:string, body:text)’



44
45
46
47
48
49
50
# File 'lib/duck_record/core.rb', line 44

def inspect
  if abstract_class?
    "#{super}(abstract)"
  else
    super
  end
end