Method: Coco::TagHelper#style_str

Defined in:
app/helpers/coco/tag_helper.rb

#style_str(styles) ⇒ Object

Converts an hash to an string of CSS styles for use in HTML style attributes



8
9
10
11
12
# File 'app/helpers/coco/tag_helper.rb', line 8

def style_str(styles)
  styles.to_h.compact.reduce([]) do |array, (key, value)|
    array << "#{key.to_s.dasherize}: #{value}"
  end.join("; ")
end