class RailsBase::Configuration::Appearance

Constants

ALLOWABLE_TYPES
APPEARANCE_TYPES
BUTTONS
DARK_MODE
DEFAULT_VALUES
DOWNSTREAM_CLASSES
LIGHT_MODE
MATCH_OS
SKIP_DOWNSTREAM_CLASSES

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/rails_base/configuration/appearance.rb, line 84
def initialize
  #####
  # all display classes are required to have ALLOWABLE_TYPES as default values
  #####
  @t_header = Configuration::Display::TableHeader.new
  @t_body = Configuration::Display::TableBody.new
  @bg_color = Configuration::Display::BackgroundColor.new
  @navbar = Configuration::Display::Navbar.new
  @text = Configuration::Display::Text.new
  @card = Configuration::Display::Card.new
  @footer = Configuration::Display::Footer.new
  @back_to_top = Configuration::Display::BackTotop.new
  @bg_light = Configuration::Display::BgLight.new

  @btn_primary = Configuration::Display::BtnPrimary.new
  @btn_secondary = Configuration::Display::BtnSecondary.new
  @btn_success = Configuration::Display::BtnSuccess.new
  @btn_danger = Configuration::Display::BtnDanger.new
  @btn_warning = Configuration::Display::BtnWarning.new
  @btn_info = Configuration::Display::BtnInfo.new
  @btn_light = Configuration::Display::BtnLight.new
  @btn_dark = Configuration::Display::BtnDark.new

  _validate_values
  super()
end

Public Instance Methods

assign_default_values!() click to toggle source
Calls superclass method
# File lib/rails_base/configuration/appearance.rb, line 118
def assign_default_values!
  super()
  DOWNSTREAM_CLASSES.each do |variable|
    instance_variable_get("@#{variable}").assign_default_values!
  end
end
validate!() click to toggle source
Calls superclass method
# File lib/rails_base/configuration/appearance.rb, line 111
def validate!
  super()
  DOWNSTREAM_CLASSES.each do |variable|
    instance_variable_get("@#{variable}").validate!
  end
end

Private Instance Methods

_validate_values() click to toggle source
# File lib/rails_base/configuration/appearance.rb, line 126
def _validate_values
  DOWNSTREAM_CLASSES.each do |var|
    next if SKIP_DOWNSTREAM_CLASSES.include?(var)

    ALLOWABLE_TYPES.each do |k, v|
      next if public_send(var).respond_to?("#{k}_mode")

      raise ArgumentError, "#{var} does not respond to #{k}_mode"
    end
  end
end