Class: CompositeContent::Model::Builder::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/composite_content/model/builder/base.rb

Overview

:nodoc:

Direct Known Subclasses

Block, Slot

Constant Summary collapse

BLOCK_SUFFIX =
'Block'
SLOT_SUFFIX =
'Slot'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(parent, association, types = []) ⇒ Object



11
12
13
# File 'lib/composite_content/model/builder/base.rb', line 11

def build(parent, association, types = [])
  new.build(parent, association, types)
end

Instance Method Details

#build(parent, association, types = []) ⇒ Object



16
17
18
19
20
21
# File 'lib/composite_content/model/builder/base.rb', line 16

def build(parent, association, types = [])
  demodulized = build_classname(parent, association).demodulize

  parent.const_set(demodulized, build_class(parent, association, types))
  parent.const_get(demodulized)
end

#build_class(_parent, _association, _types = []) ⇒ Object

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/composite_content/model/builder/base.rb', line 23

def build_class(_parent, _association, _types = [])
  raise NotImplementedError
end

#build_classname(_parent, _association) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/composite_content/model/builder/base.rb', line 27

def build_classname(_parent, _association)
  raise NotImplementedError
end