Class: Rainbow::Color::X11Named
- Inherits:
-
RGB
- Object
- Rainbow::Color
- Indexed
- RGB
- Rainbow::Color::X11Named
- Includes:
- X11ColorNames
- Defined in:
- lib/rainbow/color.rb
Constant Summary
Constants included from X11ColorNames
Instance Attribute Summary
Attributes inherited from RGB
Attributes inherited from Indexed
Attributes inherited from Rainbow::Color
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ground, name) ⇒ X11Named
constructor
A new instance of X11Named.
Methods inherited from RGB
Methods inherited from Indexed
Methods inherited from Rainbow::Color
Constructor Details
#initialize(ground, name) ⇒ X11Named
Returns a new instance of X11Named.
140 141 142 143 144 145 146 147 |
# File 'lib/rainbow/color.rb', line 140 def initialize(ground, name) unless X11Named.color_names.include?(name) raise ArgumentError, "Unknown color name, valid names: #{self.class.valid_names}" end super(ground, *NAMES[name]) end |
Class Method Details
.color_names ⇒ Object
132 133 134 |
# File 'lib/rainbow/color.rb', line 132 def self.color_names NAMES.keys end |
.valid_names ⇒ Object
136 137 138 |
# File 'lib/rainbow/color.rb', line 136 def self.valid_names color_names.join(', ') end |