Class: Nesta::Menu

Inherits:
Object
  • Object
show all
Defined in:
lib/nesta/models.rb

Constant Summary collapse

INDENT =
" " * 2

Class Method Summary collapse

Class Method Details

.for_path(path) ⇒ Object


374
375
376
377
378
379
380
381
# File 'lib/nesta/models.rb', line 374

def self.for_path(path)
  path.sub!(Regexp.new('^/'), '')
  if path.empty?
    full_menu
  else
    find_menu_item_by_path(full_menu, path)
  end
end

.full_menuObject


361
362
363
364
365
366
367
368
# File 'lib/nesta/models.rb', line 361

def self.full_menu
  menu = []
  menu_file = Nesta::Config.content_path('menu.txt')
  if File.exist?(menu_file)
    File.open(menu_file) { |file| append_menu_item(menu, file, 0) }
  end
  menu
end

.top_levelObject


370
371
372
# File 'lib/nesta/models.rb', line 370

def self.top_level
  full_menu.reject { |item| item.is_a?(Array) }
end