Class: RubyXL::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/color.rb

Class Method Summary collapse

Class Method Details

.validate_color(color) ⇒ Object

validates hex color code, no ‘#’ allowed



5
6
7
8
9
10
11
# File 'lib/color.rb', line 5

def Color.validate_color(color)
  if color =~ /^([a-f]|[A-F]|[0-9]){6}$/
    return true
  else
    raise 'invalid color'
  end
end