Class: ActiveFedora::Associations::Builder::Association
- Inherits:
-
Object
- Object
- ActiveFedora::Associations::Builder::Association
- Defined in:
- lib/active_fedora/associations/builder/association.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#mixin ⇒ Object
readonly
Returns the value of attribute mixin.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(model, name, options) ⇒ Association
constructor
A new instance of Association.
Constructor Details
#initialize(model, name, options) ⇒ Association
Returns a new instance of Association.
15 16 17 18 19 |
# File 'lib/active_fedora/associations/builder/association.rb', line 15 def initialize(model, name, ) @model, @name, @options = model, name, @mixin = Module.new @model.__send__(:include, @mixin) end |
Instance Attribute Details
#mixin ⇒ Object (readonly)
Returns the value of attribute mixin.
9 10 11 |
# File 'lib/active_fedora/associations/builder/association.rb', line 9 def mixin @mixin end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
9 10 11 |
# File 'lib/active_fedora/associations/builder/association.rb', line 9 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/active_fedora/associations/builder/association.rb', line 9 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/active_fedora/associations/builder/association.rb', line 9 def @options end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
9 10 11 |
# File 'lib/active_fedora/associations/builder/association.rb', line 9 def reflection @reflection end |
Class Method Details
.build(model, name, options) ⇒ Object
11 12 13 |
# File 'lib/active_fedora/associations/builder/association.rb', line 11 def self.build(model, name, ) new(model, name, ).build end |
Instance Method Details
#build ⇒ Object
21 22 23 24 25 26 |
# File 'lib/active_fedora/associations/builder/association.rb', line 21 def build reflection = model.create_reflection(self.class.macro, name, , model) define_accessors reflection end |