Class: PDC::Resource::Associations::Builder
- Inherits:
-
Object
- Object
- PDC::Resource::Associations::Builder
- Defined in:
- lib/pdc/resource/associations/builder.rb
Instance Method Summary collapse
- #build(parent) ⇒ Object
-
#initialize(parent_class, name, type, options = {}) ⇒ Builder
constructor
A new instance of Builder.
- #klass ⇒ Object
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, = {}) @parent_class = parent_class @name = name @type = type @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 |
#klass ⇒ Object
17 18 19 |
# File 'lib/pdc/resource/associations/builder.rb', line 17 def klass @klass ||= custom_class || compute_class(@name) end |