Class: EacRailsUtils::MenusHelper::GuiBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/eac_rails_utils/menus_helper/gui_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ GuiBuilder

Returns a new instance of GuiBuilder.


6
7
8
# File 'app/helpers/eac_rails_utils/menus_helper/gui_builder.rb', line 6

def initialize(view)
  @view = view
end

Instance Method Details

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


10
11
12
13
14
15
16
17
18
# File 'app/helpers/eac_rails_utils/menus_helper/gui_builder.rb', line 10

def build(entries, options = {})
  raise '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