Module: Lolita::Menu::NestedTree::Scope::InstanceMethods
- Defined in:
- lib/lolita-menu/nested_tree/scope.rb
Instance Method Summary collapse
- #append(item, scope_attributes = {}) ⇒ Object
- #children(*args) ⇒ Object
- #root(tree_class, scope_attributes = {}) ⇒ Object
- #sees?(tree_class) ⇒ Boolean
Instance Method Details
#append(item, scope_attributes = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/lolita-menu/nested_tree/scope.rb', line 30 def append(item, scope_attributes = {}) scope_attributes = merge_scope_with_self(item.class, scope_attributes) scope_root = self.root(item.class, scope_attributes) item.class.with_tree_scope(scope_attributes) do scope_root.append(item) item.reload end item end |
#children(*args) ⇒ Object
26 27 28 |
# File 'lib/lolita-menu/nested_tree/scope.rb', line 26 def children(*args) self.root(*args).children end |
#root(tree_class, scope_attributes = {}) ⇒ Object
22 23 24 |
# File 'lib/lolita-menu/nested_tree/scope.rb', line 22 def root(tree_class, scope_attributes = {}) tree_class.find_or_create_root(merge_scope_with_self(tree_class, scope_attributes)) end |
#sees?(tree_class) ⇒ Boolean
18 19 20 |
# File 'lib/lolita-menu/nested_tree/scope.rb', line 18 def sees?(tree_class) self.class.sees?(tree_class) end |