Module: ActsAsRecursiveTree::Model::ClassMethods

Defined in:
lib/acts_as_recursive_tree/model.rb

Instance Method Summary collapse

Instance Method Details

#ancestors_of(ids) ⇒ Object



115
116
117
# File 'lib/acts_as_recursive_tree/model.rb', line 115

def ancestors_of(ids, &)
  ActsAsRecursiveTree::Builders::Ancestors.build(self, ids, exclude_ids: true, &)
end

#descendants_of(ids) ⇒ Object



127
128
129
# File 'lib/acts_as_recursive_tree/model.rb', line 127

def descendants_of(ids, &)
  ActsAsRecursiveTree::Builders::Descendants.build(self, ids, exclude_ids: true, &)
end

#leaves_of(ids) ⇒ Object



131
132
133
# File 'lib/acts_as_recursive_tree/model.rb', line 131

def leaves_of(ids, &)
  ActsAsRecursiveTree::Builders::Leaves.build(self, ids, &)
end

#roots_of(ids) ⇒ Object



119
120
121
# File 'lib/acts_as_recursive_tree/model.rb', line 119

def roots_of(ids)
  self_and_ancestors_of(ids).roots
end

#self_and_ancestors_of(ids) ⇒ Object



111
112
113
# File 'lib/acts_as_recursive_tree/model.rb', line 111

def self_and_ancestors_of(ids, &)
  ActsAsRecursiveTree::Builders::Ancestors.build(self, ids, &)
end

#self_and_descendants_of(ids) ⇒ Object



123
124
125
# File 'lib/acts_as_recursive_tree/model.rb', line 123

def self_and_descendants_of(ids, &)
  ActsAsRecursiveTree::Builders::Descendants.build(self, ids, &)
end