Class: FeduxOrgStdlib::Colors::HtmlColor

Inherits:
Object
  • Object
show all
Defined in:
lib/fedux_org_stdlib/colors/html_color.rb

Instance Method Summary collapse

Constructor Details

#initialize(color) ⇒ HtmlColor

Returns a new instance of HtmlColor.

Parameters:

  • color (String)

    string in the html color format



7
8
9
10
# File 'lib/fedux_org_stdlib/colors/html_color.rb', line 7

def initialize( color )
  @color = color
  @validator_regex = /^#[a-f0-9]{6}$/
end

Instance Method Details

#valid?true, false

Returns color string is valid.

Returns:

  • (true, false)

    color string is valid



13
14
15
# File 'lib/fedux_org_stdlib/colors/html_color.rb', line 13

def valid?
  @validator_regex === @color
end