Class: Primer::ResponsiveArg
- Inherits:
-
Object
- Object
- Primer::ResponsiveArg
- Includes:
- FetchOrFallbackHelper
- Defined in:
- app/components/primer/responsive_arg.rb
Overview
Base class for responsive Stack and StackItem arguments. Used internally.
Direct Known Subclasses
Alpha::Stack::AlignArg, Alpha::Stack::DirectionArg, Alpha::Stack::GapArg, Alpha::Stack::JustifyArg, Alpha::Stack::PaddingArg, Alpha::Stack::WrapArg, Alpha::StackItem::GrowArg
Constant Summary collapse
- BREAKPOINTS =
[:narrow, :regular, :wide].freeze
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Class Method Summary collapse
-
.arg_name ⇒ Object
:nocov:.
- .for(values) ⇒ Object
Instance Method Summary collapse
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Class Method Details
.arg_name ⇒ Object
:nocov:
16 17 18 |
# File 'app/components/primer/responsive_arg.rb', line 16 def arg_name raise NotImplementedError, "Subclasses must implement the `#{__method__}' method" end |
.for(values) ⇒ Object
11 12 13 |
# File 'app/components/primer/responsive_arg.rb', line 11 def for(values) cache[[values, arg_name].hash] ||= new(values) end |
Instance Method Details
#to_data_attributes ⇒ Object
28 29 30 |
# File 'app/components/primer/responsive_arg.rb', line 28 def to_data_attributes @data_attributes ||= data_attributes_for(self.class.arg_name, values) end |