Sha256: 3d3dd72fc5eda134ff69fd293b03221972b60ab52417aa9d8e6518196f83c238
Contents?: true
Size: 388 Bytes
Versions: 1
Compression:
Stored size: 388 Bytes
Contents
module Iz class HexColor REGEX = /^([0-9a-f]{3}|[0-9a-f]{6})$/i attr_accessor :value def initialize(hex_color) self.value = hex_color end def valid? !!Iz::HexColor.is_hex_color?(value) end def self.is_hex_color?(value) val = value.to_s.dup return false unless val[0] == '#' val[0] = '' val =~ REGEX end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iz-0.3.1 | lib/iz/hex_color.rb |