Class: PDC::Resource::Associations::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/pdc/resource/associations/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent_class, name, type, options = {}) ⇒ Builder

Returns a new instance of Builder.



6
7
8
9
10
11
# File 'lib/pdc/resource/associations/builder.rb', line 6

def initialize(parent_class, name, type, options = {})
  @parent_class = parent_class
  @name = name
  @type = type
  @options = options
end

Instance Method Details

#build(parent) ⇒ Object



13
14
15
# File 'lib/pdc/resource/associations/builder.rb', line 13

def build(parent)
  @type.new(klass, parent, @name, @options)
end

#klassObject



17
18
19
# File 'lib/pdc/resource/associations/builder.rb', line 17

def klass
  @klass ||= custom_class || compute_class(@name)
end