Class: Waiter::Menu::Drawer

Inherits:
Object
  • Object
show all
Defined in:
lib/waiter/menu/drawer.rb

Overview

Outputs a Menu into HTML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(menu, context) ⇒ Drawer

Returns a new instance of Drawer.



11
12
13
14
15
# File 'lib/waiter/menu/drawer.rb', line 11

def initialize(menu, context)
  # context is a Controller binding, which allows the ActionView helpers to work in the correct context
  @context = context
  @menu = menu
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



7
8
9
# File 'lib/waiter/menu/drawer.rb', line 7

def context
  @context
end

Returns the value of attribute menu.



7
8
9
# File 'lib/waiter/menu/drawer.rb', line 7

def menu
  @menu
end

Instance Method Details

#drawObject



17
18
19
# File 'lib/waiter/menu/drawer.rb', line 17

def draw
  render partial: 'waiter/menu_bar', locals: { menu: menu }
end