Class: MenuBuilder
- Inherits:
-
Object
- Object
- MenuBuilder
- Defined in:
- lib/sinatra/extensions/menu.rb
Instance Method Summary collapse
- #build ⇒ Object
- #dropdown(text, icon, submenu) ⇒ Object
-
#initialize ⇒ MenuBuilder
constructor
A new instance of MenuBuilder.
- #link(text, icon, link, target) ⇒ Object
- #modal(text, icon, link) ⇒ Object
Constructor Details
#initialize ⇒ MenuBuilder
Returns a new instance of MenuBuilder.
4 5 6 |
# File 'lib/sinatra/extensions/menu.rb', line 4 def initialize @elements = [] end |
Instance Method Details
#build ⇒ Object
23 24 25 |
# File 'lib/sinatra/extensions/menu.rb', line 23 def build @elements end |
#dropdown(text, icon, submenu) ⇒ Object
8 9 10 11 |
# File 'lib/sinatra/extensions/menu.rb', line 8 def dropdown(text,icon,) @elements << { :type => 'dropdown' , :text => text, :icon => icon, :link => } return self end |
#link(text, icon, link, target) ⇒ Object
13 14 15 16 |
# File 'lib/sinatra/extensions/menu.rb', line 13 def link(text,icon,link,target) @elements << { :type => 'link' , :text => text, :icon => icon, :link => link, :target => target } return self end |
#modal(text, icon, link) ⇒ Object
18 19 20 21 |
# File 'lib/sinatra/extensions/menu.rb', line 18 def modal(text,icon,link) @elements << { :type => 'modal' , :text => text, :icon => icon, :link => link } return self end |