Module: Polaris::StylesListHelper

Included in:
Component
Defined in:
app/helpers/polaris/styles_list_helper.rb

Instance Method Summary collapse

Instance Method Details

#styles_list(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/polaris/styles_list_helper.rb', line 5

def styles_list(*args)
  list = []

  args.each do |style|
    case style
    when Hash
      style.each do |key, val|
        list << [key, val] if val
      end
    when Array
      list << styles_list(*style).presence
    end
  end

  list.compact.uniq.map { |k, v| "#{k}: #{v}" }.join(";")
end