Sha256: 79ed3ef577f73b1afb6f224fe5282e8f307396644baca7e04d9ce8a680c637b5
Contents?: true
Size: 785 Bytes
Versions: 2
Compression:
Stored size: 785 Bytes
Contents
# frozen_string_literal: true module Bs5 module ComponentsHelper COMPONENTS = %w[accordion alert badge close_button breadcrumb button_tag button_to list_group].freeze COMPONENTS.each do |name| define_method("bs5_#{name}") do |*args, &block| clazz = "Bs5::#{name.classify}Component".constantize render_component(clazz, *args, &block) end end def bs5_tooltip(*args) TooltipService.new(*args).to_hash end def bs5_popover(*args) PopoverService.new(*args).to_hash end def bs5_collapse(*args) CollapseService.new(*args).to_hash end private def render_component(component_clazz, *args) render component_clazz.new(*args) do |c| yield c if block_given? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bs5-0.0.17 | app/helpers/bs5/components_helper.rb |
bs5-0.0.16 | app/helpers/bs5/components_helper.rb |