Class: Primer::ResponsiveArg

Inherits:
Object
  • Object
show all
Includes:
FetchOrFallbackHelper
Defined in:
app/components/primer/responsive_arg.rb

Overview

Base class for responsive Stack and StackItem arguments. Used internally.

Constant Summary collapse

BREAKPOINTS =
[:narrow, :regular, :wide].freeze

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Class Method Details

.arg_nameObject

:nocov:

Raises:

  • (NotImplementedError)


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_attributesObject



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