Class: Eac::MenusHelper::GuiBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/eac/menus_helper/gui_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ GuiBuilder

Returns a new instance of GuiBuilder.



4
5
6
# File 'lib/eac/menus_helper/gui_builder.rb', line 4

def initialize(view)
  @view = view
end

Instance Method Details

#build(entries, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/eac/menus_helper/gui_builder.rb', line 8

def build(entries, options = {})
  fail "Argument \"entries\" is not a array" unless entries.is_a?(Array)
  @view.(:ul, options) do
    b = ActiveSupport::SafeBuffer.new
    entries.map { |v| menu_entry(v) }.each { |e| b << e }
    b
  end
end