Class: Zermelo::Associations::AssociationData
- Inherits:
-
Object
- Object
- Zermelo::Associations::AssociationData
- Defined in:
- lib/zermelo/associations/association_data.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
-
#data_klass_name ⇒ Object
writeonly
Sets the attribute data_klass_name.
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#inverse ⇒ Object
Returns the value of attribute inverse.
-
#name ⇒ Object
Returns the value of attribute name.
-
#related_klass_names ⇒ Object
writeonly
Sets the attribute related_klass_names.
-
#sort_key ⇒ Object
Returns the value of attribute sort_key.
-
#sort_order ⇒ Object
Returns the value of attribute sort_order.
-
#type_klass ⇒ Object
Returns the value of attribute type_klass.
Instance Method Summary collapse
- #data_klass ⇒ Object
-
#initialize(opts = {}) ⇒ AssociationData
constructor
A new instance of AssociationData.
- #related_klasses ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ AssociationData
Returns a new instance of AssociationData.
8 9 10 11 12 13 14 |
# File 'lib/zermelo/associations/association_data.rb', line 8 def initialize(opts = {}) [:name, :type_klass, :data_type, :inverse, :sort_key, :sort_order, :callbacks, :data_klass_name, :related_klass_names].each do |a| send("#{a}=".to_sym, opts[a]) end end |
Instance Attribute Details
#callbacks ⇒ Object
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def callbacks @callbacks end |
#data_klass_name=(value) ⇒ Object (writeonly)
Sets the attribute data_klass_name
4 5 6 |
# File 'lib/zermelo/associations/association_data.rb', line 4 def data_klass_name=(value) @data_klass_name = value end |
#data_type ⇒ Object
Returns the value of attribute data_type.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def data_type @data_type end |
#inverse ⇒ Object
Returns the value of attribute inverse.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def inverse @inverse end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def name @name end |
#related_klass_names=(value) ⇒ Object (writeonly)
Sets the attribute related_klass_names
4 5 6 |
# File 'lib/zermelo/associations/association_data.rb', line 4 def (value) @related_klass_names = value end |
#sort_key ⇒ Object
Returns the value of attribute sort_key.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def sort_key @sort_key end |
#sort_order ⇒ Object
Returns the value of attribute sort_order.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def sort_order @sort_order end |
#type_klass ⇒ Object
Returns the value of attribute type_klass.
5 6 7 |
# File 'lib/zermelo/associations/association_data.rb', line 5 def type_klass @type_klass end |
Instance Method Details
#data_klass ⇒ Object
16 17 18 |
# File 'lib/zermelo/associations/association_data.rb', line 16 def data_klass @data_klass ||= @data_klass_name.constantize end |
#related_klasses ⇒ Object
20 21 22 |
# File 'lib/zermelo/associations/association_data.rb', line 20 def @related_klasses ||= (@related_klass_names || []).map(&:constantize) end |