Class: HakumiComponents::Skeleton::TitleConfig
- Inherits:
-
Object
- Object
- HakumiComponents::Skeleton::TitleConfig
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/skeleton/title_config.rb
Constant Summary collapse
- WidthValue =
T.type_alias { T.any(Integer, String) }
- Input =
T.type_alias { T.any(T::Boolean, Types::HtmlAttributes, HakumiComponents::Skeleton::TitleConfig) }
Instance Attribute Summary collapse
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(width: nil) ⇒ TitleConfig
constructor
A new instance of TitleConfig.
Constructor Details
#initialize(width: nil) ⇒ TitleConfig
Returns a new instance of TitleConfig.
13 14 15 |
# File 'app/components/hakumi_components/skeleton/title_config.rb', line 13 def initialize(width: nil) @width = T.let(width, T.nilable(WidthValue)) end |
Instance Attribute Details
#width ⇒ Object (readonly)
Returns the value of attribute width.
18 19 20 |
# File 'app/components/hakumi_components/skeleton/title_config.rb', line 18 def width @width end |
Class Method Details
.coerce(value) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/components/hakumi_components/skeleton/title_config.rb', line 21 def self.coerce(value) return nil if value == false return new if value == true return value if value.is_a?(HakumiComponents::Skeleton::TitleConfig) width = value[:width] new(width: width.is_a?(Integer) || width.is_a?(String) ? width : nil) end |