Module: Govuk::Components::Helpers::CssUtilities

Defined in:
lib/govuk/components/helpers/css_utilities.rb

Instance Method Summary collapse

Instance Method Details

#combine_classes(default_classes, custom_classes) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/govuk/components/helpers/css_utilities.rb', line 5

def combine_classes(default_classes, custom_classes)
  converted_custom_classes = case custom_classes
                             when Array
                               custom_classes
                             when String
                               custom_classes.split
                             when NilClass
                               []
                             else
                               fail(ArgumentError, "custom classes must be a String, Array or NilClass")
                             end

  default_classes.concat(converted_custom_classes).uniq
end