Module: ViewPrimitives::ComponentHelper
- Defined in:
- lib/view_primitives/component_helper.rb
Instance Method Summary collapse
-
#ui(name) ⇒ Object
<%= ui :button, variant: :outline do %>Click<% end %>.
Instance Method Details
#ui(name) ⇒ Object
<%= ui :button, variant: :outline do %>Click<% end %>
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/view_primitives/component_helper.rb', line 8 def ui(name, *, **, &) klass = "UI::#{name.to_s.camelize}Component".safe_constantize unless klass raise ViewPrimitives::ComponentNotFoundError, "Component `UI::#{name.to_s.camelize}Component` not found. " \ "Run `rails g view_primitives:add #{name}` to generate it." end render(klass.new(*, **), &) end |