Class: Spyke::Associations::Builder
- Inherits:
-
Object
- Object
- Spyke::Associations::Builder
- Defined in:
- lib/spyke/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.
4 5 6 |
# File 'lib/spyke/associations/builder.rb', line 4 def initialize(parent_class, name, type, = {}) @parent_class, @name, @type, @options = parent_class, name, type, end |
Instance Method Details
#build(parent) ⇒ Object
8 9 10 |
# File 'lib/spyke/associations/builder.rb', line 8 def build(parent) @type.new(klass, parent, @name, @options) end |
#klass ⇒ Object
12 13 14 |
# File 'lib/spyke/associations/builder.rb', line 12 def klass @klass ||= custom_class || compute_class(@name) end |