Module: GOVUKDesignSystemFormBuilder::Traits::HTMLClasses
- Included in:
- Containers::CheckBoxes, Containers::FormGroup, Containers::Radios, Elements::Caption, Elements::Date, Elements::File, Elements::Hint, Elements::Label, Elements::Legend, Elements::Password, Elements::Submit, Elements::TextArea
- Defined in:
- lib/govuk_design_system_formbuilder/traits/html_classes.rb
Instance Method Summary collapse
-
#build_classes(*args, **kwargs) ⇒ Object
combine all the classes in *args with any keys from **kwargs where the value is true.
Instance Method Details
#build_classes(*args, **kwargs) ⇒ Object
combine all the classes in *args with any keys from **kwargs where the value is true. Roughly based on the behaviour from Rails’ class_names, but recreated here as that returns a string where we want an array.
8 9 10 |
# File 'lib/govuk_design_system_formbuilder/traits/html_classes.rb', line 8 def build_classes(*args, **kwargs) (args + kwargs.map { |k, v| k if v }).compact end |