Sha256: 55fb91ffaeb72627a868139b48e779d04a73cf0a5068992ef1eb275d03f6d18f
Contents?: true
Size: 768 Bytes
Versions: 1
Compression:
Stored size: 768 Bytes
Contents
# frozen_string_literal: true module Bs5 module ComponentsHelper COMPONENTS = %w[accordion alert badge close_button breadcrumb button_tag button_to].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(title, options = nil) default_options = { toggle: :tooltip } options = Hash(options).symbolize_keys.merge(default_options) { title: title, data: options } 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bs5-0.0.12 | app/helpers/bs5/components_helper.rb |