Sha256: 6ff84aa9aaacbbfa901d878297db478856071509ad2e84ef8ae9fbba623fee04
Contents?: true
Size: 583 Bytes
Versions: 25
Compression:
Stored size: 583 Bytes
Contents
module ActionView module Helpers module Tags # :nodoc: class ColorField < TextField # :nodoc: def render options = @options.stringify_keys options["value"] = options.fetch("value") { validate_color_string(value(object)) } @options = options super end private def validate_color_string(string) regex = /#[0-9a-fA-F]{6}/ if regex.match(string) string.downcase else "#000000" end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems