Class: Anchormodel::Attribute
- Inherits:
-
Object
- Object
- Anchormodel::Attribute
- Defined in:
- lib/anchormodel/attribute.rb
Overview
This class holds all information related to a Rails model pointing to an Anchormodel. It is instanciated when ModelMixin#belongs_to_anchormodel is used.
Instance Attribute Summary collapse
- #anchormodel_class ⇒ Object readonly
- #attribute_name ⇒ Object readonly
- #optional ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(model_class, attribute_name, anchormodel_class = nil, optional = false, multiple = false) ⇒ Attribute
constructor
A new instance of Attribute.
- #multiple? ⇒ Boolean
Constructor Details
#initialize(model_class, attribute_name, anchormodel_class = nil, optional = false, multiple = false) ⇒ Attribute
Returns a new instance of Attribute.
14 15 16 17 18 19 20 |
# File 'lib/anchormodel/attribute.rb', line 14 def initialize(model_class, attribute_name, anchormodel_class = nil, optional = false, multiple = false) @model_class = model_class @attribute_name = attribute_name.to_sym @anchormodel_class = anchormodel_class @optional = optional @multiple = multiple end |
Instance Attribute Details
#anchormodel_class ⇒ Object (readonly)
6 7 8 |
# File 'lib/anchormodel/attribute.rb', line 6 def anchormodel_class @anchormodel_class end |
#attribute_name ⇒ Object (readonly)
5 6 7 |
# File 'lib/anchormodel/attribute.rb', line 5 def attribute_name @attribute_name end |
#optional ⇒ Object (readonly)
7 8 9 |
# File 'lib/anchormodel/attribute.rb', line 7 def optional @optional end |
Instance Method Details
#multiple? ⇒ Boolean
22 23 24 |
# File 'lib/anchormodel/attribute.rb', line 22 def multiple? @multiple end |