class MenuMaker::Menu::MenuItem

Attributes

options[R]
submenu[RW]
title[R]

Public Class Methods

new(title, *paths, **options) click to toggle source
# File lib/menu_maker/menu.rb, line 79
def initialize(title, *paths, **options)
  @title   = title
  @paths   = paths.map { |p| Path::Converter.convert(p) }
  @options = options
end

Public Instance Methods

all_paths() click to toggle source
# File lib/menu_maker/menu.rb, line 103
def all_paths
  [*paths, *submenu_paths]
end
has_path?(path) click to toggle source
# File lib/menu_maker/menu.rb, line 107
def has_path?(path)
  all_paths.include? Path::Converter.convert(path)
end
has_submenu?() click to toggle source
# File lib/menu_maker/menu.rb, line 87
def has_submenu?
  !@submenu.nil?
end
method_missing(method, *args) click to toggle source
# File lib/menu_maker/menu.rb, line 111
def method_missing(method, *args)
  options && options[method] || ''
end
path() click to toggle source
# File lib/menu_maker/menu.rb, line 119
def path
  @paths.first.path
end
paths() click to toggle source
# File lib/menu_maker/menu.rb, line 91
def paths
  @paths
end
render_submenu() click to toggle source
# File lib/menu_maker/menu.rb, line 123
def render_submenu
  has_submenu? ? submenu.render : ''
end
respond_to_missing?(method) click to toggle source
# File lib/menu_maker/menu.rb, line 115
def respond_to_missing?(method)
  !!(options && options[method])
end
submenu_paths() click to toggle source
to_s() click to toggle source
# File lib/menu_maker/menu.rb, line 127
def to_s
  title
end