Class: Opium::Model::Relatable::Metadata
- Defined in:
- lib/opium/model/relatable/metadata.rb
Instance Attribute Summary collapse
-
#inverse_relation_name ⇒ Object
readonly
Returns the value of attribute inverse_relation_name.
-
#inverse_relation_type ⇒ Object
readonly
Returns the value of attribute inverse_relation_type.
-
#owning_class_name ⇒ Object
readonly
Returns the value of attribute owning_class_name.
-
#relation_name ⇒ Object
readonly
Returns the value of attribute relation_name.
-
#relation_type ⇒ Object
readonly
Returns the value of attribute relation_type.
-
#target_class_name ⇒ Object
readonly
Returns the value of attribute target_class_name.
Instance Method Summary collapse
-
#initialize(klass, relation_type, relation_name, options = {}) ⇒ Metadata
constructor
A new instance of Metadata.
Constructor Details
#initialize(klass, relation_type, relation_name, options = {}) ⇒ Metadata
Returns a new instance of Metadata.
7 8 9 10 11 12 13 |
# File 'lib/opium/model/relatable/metadata.rb', line 7 def initialize( klass, relation_type, relation_name, = {} ) self.owning_class_name = klass.model_name self.relation_type = relation_type self.relation_name = relation_name self.target_class_name = ([:class_name] || relation_name).to_s.classify self.inverse_relation_name = ([:inverse_of] || determine_inverse_relation_name).to_s end |
Instance Attribute Details
#inverse_relation_name ⇒ Object
Returns the value of attribute inverse_relation_name.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def inverse_relation_name @inverse_relation_name end |
#inverse_relation_type ⇒ Object
Returns the value of attribute inverse_relation_type.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def inverse_relation_type @inverse_relation_type end |
#owning_class_name ⇒ Object
Returns the value of attribute owning_class_name.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def owning_class_name @owning_class_name end |
#relation_name ⇒ Object
Returns the value of attribute relation_name.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def relation_name @relation_name end |
#relation_type ⇒ Object
Returns the value of attribute relation_type.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def relation_type @relation_type end |
#target_class_name ⇒ Object
Returns the value of attribute target_class_name.
5 6 7 |
# File 'lib/opium/model/relatable/metadata.rb', line 5 def target_class_name @target_class_name end |