Class: Primer::Alpha::Stack::JustifyArg

Inherits:
ResponsiveArg show all
Defined in:
app/components/primer/alpha/stack.rb

Overview

Stack’s justify argument. Used internally.

Constant Summary collapse

DEFAULT =
:start
MAPPING =
{
  DEFAULT => "start",
  :center => "center",
  :end => "end",
  :space_between => "space-between",
  :space_evenly => "space-evenly"
}.freeze
OPTIONS =
[nil, *MAPPING.keys.freeze]

Constants inherited from ResponsiveArg

ResponsiveArg::BREAKPOINTS

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResponsiveArg

for, #to_data_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Constructor Details

#initialize(values) ⇒ JustifyArg

Returns a new instance of JustifyArg.



22
23
24
25
26
# File 'app/components/primer/alpha/stack.rb', line 22

def initialize(values)
  @values = fetch_or_fallback_all(OPTIONS, values, DEFAULT) do |value|
    MAPPING[value]
  end
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



11
12
13
# File 'app/components/primer/alpha/stack.rb', line 11

def values
  @values
end

Class Method Details

.arg_nameObject



28
29
30
# File 'app/components/primer/alpha/stack.rb', line 28

def self.arg_name
  :justify
end