Class: GOVUKDesignSystemFormBuilder::Elements::Caption
- Defined in:
- lib/govuk_design_system_formbuilder/elements/caption.rb
Constant Summary
Constants included from Traits::Localisation
Traits::Localisation::BASE_NAME_REGEXP
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, text: nil, size: config.default_caption_size, **kwargs) ⇒ Caption
constructor
A new instance of Caption.
Methods included from Traits::HTMLClasses
Methods included from Traits::HTMLAttributes
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, text: nil, size: config.default_caption_size, **kwargs) ⇒ Caption
Returns a new instance of Caption.
8 9 10 11 12 13 14 |
# File 'lib/govuk_design_system_formbuilder/elements/caption.rb', line 8 def initialize(builder, object_name, attribute_name, text: nil, size: config., **kwargs) super(builder, object_name, attribute_name) @text = text(text) @size_class = size_class(size) @html_attributes = kwargs end |
Instance Method Details
#html ⇒ Object
16 17 18 19 20 |
# File 'lib/govuk_design_system_formbuilder/elements/caption.rb', line 16 def html return unless active? tag.span(@text, **attributes(@html_attributes)) end |