Class: HakumiComponents::Tabs::IndicatorConfig
- Inherits:
-
Object
- Object
- HakumiComponents::Tabs::IndicatorConfig
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/tabs/indicator_config.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(size: nil, align: :center) ⇒ IndicatorConfig
constructor
A new instance of IndicatorConfig.
Constructor Details
#initialize(size: nil, align: :center) ⇒ IndicatorConfig
Returns a new instance of IndicatorConfig.
10 11 12 13 |
# File 'app/components/hakumi_components/tabs/indicator_config.rb', line 10 def initialize(size: nil, align: :center) @size = T.let(size, T.nilable(Numeric)) @align = T.let(align, Symbol) end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
19 20 21 |
# File 'app/components/hakumi_components/tabs/indicator_config.rb', line 19 def align @align end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
16 17 18 |
# File 'app/components/hakumi_components/tabs/indicator_config.rb', line 16 def size @size end |
Class Method Details
.coerce(value) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/hakumi_components/tabs/indicator_config.rb', line 22 def self.coerce(value) return new if value.nil? raw_size = value[:size] raw_align = value[:align] new( size: raw_size.is_a?(Numeric) ? raw_size : nil, align: raw_align.is_a?(Symbol) ? raw_align : raw_align.is_a?(String) ? raw_align.to_sym : :center ) end |