Sha256: 14550266aec7b8b9d8d57f4e44db6e2d73663066196beffea492300285307d3a
Contents?: true
Size: 495 Bytes
Versions: 73
Compression:
Stored size: 495 Bytes
Contents
module Coco module TagHelper def prefix_attr_keys(attrs, prefix) attrs.transform_keys! { [prefix, _1].map(&:to_s).join("-") } end # Converts an hash to an string of CSS styles for use in HTML `style` attributes def style_str(styles) styles.to_h.compact.reduce([]) do |array, (key, value)| array << "#{key.to_s.dasherize}: #{value}" end.join("; ") end def random_id(length = 6) ("a".."z").to_a.shuffle[0, length].join end end end
Version data entries
73 entries across 73 versions & 1 rubygems