Class: Essence::CardComponent::RibbonComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/essence/card_component.rb

Constant Summary collapse

DEFAULT_VARIANT =
:light
VARIANT_MAPPINGS =
{
  DEFAULT_VARIANT => 'card-ribbon-light',
  :dark => 'card-ribbon-dark'
}.freeze
VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys.freeze

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationComponent

assets_path, images_directory

Methods included from Utils

#get_directory_file_names

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #integer_or_fallback

Constructor Details

#initialize(text:, variant: DEFAULT_VARIANT, **html_options) ⇒ RibbonComponent



29
30
31
32
33
34
35
# File 'app/components/essence/card_component.rb', line 29

def initialize(text:,
               variant: DEFAULT_VARIANT,
               **html_options)
  @text         = text
  @variant      = fetch_or_fallback(VARIANT_OPTIONS, variant.to_sym, DEFAULT_VARIANT)
  @html_options = html_options
end

Instance Attribute Details

#html_optionsObject (readonly)

Returns the value of attribute html_options.



18
19
20
# File 'app/components/essence/card_component.rb', line 18

def html_options
  @html_options
end

#textObject (readonly)

Returns the value of attribute text.



18
19
20
# File 'app/components/essence/card_component.rb', line 18

def text
  @text
end