Class: RubyNative::Helper::NavbarMenuBuilder
- Inherits:
-
Object
- Object
- RubyNative::Helper::NavbarMenuBuilder
- Defined in:
- lib/ruby_native/helper.rb
Instance Method Summary collapse
-
#initialize(context) ⇒ NavbarMenuBuilder
constructor
A new instance of NavbarMenuBuilder.
- #item(title, href: nil, click: nil, icon: nil, selected: false) ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(context) ⇒ NavbarMenuBuilder
Returns a new instance of NavbarMenuBuilder.
165 166 167 168 |
# File 'lib/ruby_native/helper.rb', line 165 def initialize(context) @context = context @items = [] end |
Instance Method Details
#item(title, href: nil, click: nil, icon: nil, selected: false) ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/ruby_native/helper.rb', line 170 def item(title, href: nil, click: nil, icon: nil, selected: false) data = { native_menu_item: "", native_title: title } data[:native_href] = href if href data[:native_click] = click if click data[:native_icon] = icon if icon data[:native_selected] = "" if selected @items << @context.tag.div(data: data) end |
#to_html ⇒ Object
179 180 181 |
# File 'lib/ruby_native/helper.rb', line 179 def to_html @context.safe_join(@items) end |