Class: Refinery::Menu
- Inherits:
-
Object
- Object
- Refinery::Menu
- Defined in:
- lib/refinery/menu.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(objects = nil) ⇒ Menu
constructor
A new instance of Menu.
- #roots ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
11 12 13 |
# File 'lib/refinery/menu.rb', line 11 def items @items end |
Instance Method Details
#roots ⇒ Object
17 18 19 |
# File 'lib/refinery/menu.rb', line 17 def roots @roots ||= items.select {|item| item.parent_id.nil?} end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/refinery/menu.rb', line 21 def to_s items.map(&:title).join(' ') end |