Class: Fullstack::Admin::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/fullstack/admin/resources.rb

Direct Known Subclasses

Group, Resource, Resources

Instance Method Summary collapse

Instance Method Details

#leaf?Boolean

leaf? parent children entity_type

Returns:

  • (Boolean)


10
11
12
# File 'lib/fullstack/admin/resources.rb', line 10

def leaf?
  self.children.empty?
end

#traverse_bottom_up(&block) ⇒ Object Also known as: reverse_each



23
24
25
26
27
28
# File 'lib/fullstack/admin/resources.rb', line 23

def traverse_bottom_up(&block)
  children.each do |c|
    c.traverse_bottom_up(&block)
  end
  block.call(self)
end

#traverse_top_down(&block) ⇒ Object Also known as: each



14
15
16
17
18
19
20
# File 'lib/fullstack/admin/resources.rb', line 14

def traverse_top_down(&block)
  res = block.call(self)
  children.each do |c|
    c.traverse_top_down(&block)
  end
  res
end