Class: Primrose::Components::List
- Defined in:
- lib/primrose/components/list.rb
Constant Summary collapse
- TEMPLATE =
"<ul class=\"<%= @style_class %>\">\n <% @items.each do |item| %>\n <li><%= item %></li>\n <% end %>\n</ul>\n"
Instance Attribute Summary
Attributes inherited from Rose
#children, #event_handlers, #state
Instance Method Summary collapse
-
#initialize(items:, id: nil, style_class: nil) ⇒ List
constructor
A new instance of List.
- #render ⇒ Object
Methods inherited from Rose
#add_child, #get_binding, #handle_error, #lifecycle, #on, #render_children, #trigger
Constructor Details
#initialize(items:, id: nil, style_class: nil) ⇒ List
Returns a new instance of List.
12 13 14 15 16 17 |
# File 'lib/primrose/components/list.rb', line 12 def initialize(items:, id: nil, style_class: nil) @items = items @id = id @style_class = style_class super() end |
Instance Method Details
#render ⇒ Object
19 20 21 |
# File 'lib/primrose/components/list.rb', line 19 def render Prim.render(TEMPLATE, self) end |