Class: Mongoid::SleepingKingStudios::HasTree::Children::Metadata
- Inherits:
-
Concern::Metadata
- Object
- Hash
- Concern::Metadata
- Mongoid::SleepingKingStudios::HasTree::Children::Metadata
- Defined in:
- lib/mongoid/sleeping_king_studios/has_tree/children/metadata.rb
Overview
Stores information about a HasTree concern’s children relation.
Instance Attribute Summary
Attributes inherited from Concern::Metadata
Instance Method Summary collapse
-
#inverse_of ⇒ Symbol
The name of the tree’s parent relation.
-
#inverse_of? ⇒ Boolean
True if a custom inverse relation name is set; otherwise false.
-
#relation_name ⇒ Symbol
The name of the tree’s children relation.
-
#relation_name? ⇒ Boolean
True if a custom relation name is set; otherwise false.
Methods inherited from Concern::Metadata
#characterize, #initialize, #relation_key, #relation_key?
Constructor Details
This class inherits a constructor from Mongoid::SleepingKingStudios::Concern::Metadata
Instance Method Details
#inverse_of ⇒ Symbol
The name of the tree’s parent relation. If no relation name is set, defaults to :parent.
14 15 16 |
# File 'lib/mongoid/sleeping_king_studios/has_tree/children/metadata.rb', line 14 def inverse_of fetch(:inverse_of, :parent) end |
#inverse_of? ⇒ Boolean
Returns True if a custom inverse relation name is set; otherwise false.
20 21 22 |
# File 'lib/mongoid/sleeping_king_studios/has_tree/children/metadata.rb', line 20 def inverse_of? !!self[:inverse_of] end |
#relation_name ⇒ Symbol
The name of the tree’s children relation. If no relation name is set, defaults to :children.
28 29 30 |
# File 'lib/mongoid/sleeping_king_studios/has_tree/children/metadata.rb', line 28 def relation_name fetch(:relation_name, :children) end |
#relation_name? ⇒ Boolean
Returns True if a custom relation name is set; otherwise false.
34 35 36 |
# File 'lib/mongoid/sleeping_king_studios/has_tree/children/metadata.rb', line 34 def relation_name? !!self[:relation_name] end |