Class: Essence::CardComponent::RibbonComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Essence::CardComponent::RibbonComponent
- 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
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, variant: DEFAULT_VARIANT, **html_options) ⇒ RibbonComponent
constructor
A new instance of RibbonComponent.
Methods inherited from ApplicationComponent
Methods included from Utils
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, **) @text = text @variant = fetch_or_fallback(VARIANT_OPTIONS, variant.to_sym, DEFAULT_VARIANT) = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
18 19 20 |
# File 'app/components/essence/card_component.rb', line 18 def end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
18 19 20 |
# File 'app/components/essence/card_component.rb', line 18 def text @text end |