Class: Bootstrap5Helper::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap5_helper/configuration.rb

Overview

TODO:

Build a better, more comprehensive system.

Simple configuration object for setting options for the gem.

Constant Summary collapse

DEFAULT_SETTINGS =
{
  autoload_in_views: true,
  accordions:        {
    header: :h2,
    body:   :div
  },
  badges:            {
    contrast: false,
    base:     :span
  },
  callouts:          {
    header: :h4
  },
  cards:             {
    header:   :h5,
    body:     :div,
    footer:   :div,
    title:    :h5,
    subtitle: :h6,
    text:     :p
  },
  dropdowns:         {},
  overlay_menus:     {
    base:    :div,
    text:    :span,
    header:  :h6,
    divider: :div
  },
  modals:            {
    title: :h5
  },
  navs:              {
    base: :ul
  },
  offcanvas:         {
    header:  :div,
    title:   :h5,
    close:   :button,
    body:    :div,
    trigger: :div
  },
  page_header:       :h1
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(_args = {}) ⇒ ClassName

Class constructor

Parameters:

  • _args (Hash) (defaults to: {})


58
59
60
# File 'lib/bootstrap5_helper/configuration.rb', line 58

def initialize(_args = {})
  DEFAULT_SETTINGS.each { |key, value| instance_variable_set("@#{key}", value) }
end

Instance Method Details

#autoload_in_views?Boolean

Simple predicate method

Returns:

  • (Boolean)


66
67
68
# File 'lib/bootstrap5_helper/configuration.rb', line 66

def autoload_in_views?
  @autoload_in_views
end