Module: GOVUKDesignSystemFormBuilder::Traits::HTMLClasses

Instance Method Summary collapse

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