Class: AsciiMath::ColorTableBuilder
- Inherits:
-
Object
- Object
- AsciiMath::ColorTableBuilder
- Defined in:
- lib/asciimath/color_table.rb
Instance Method Summary collapse
- #add(*names, r, g, b) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ ColorTableBuilder
constructor
A new instance of ColorTableBuilder.
Constructor Details
#initialize ⇒ ColorTableBuilder
Returns a new instance of ColorTableBuilder.
3 4 5 |
# File 'lib/asciimath/color_table.rb', line 3 def initialize() @table = {} end |
Instance Method Details
#add(*names, r, g, b) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/asciimath/color_table.rb', line 7 def add(*names, r, g, b) entry = { :r => r, :g => g, :b => b }.freeze names.each { |name| @table[name.freeze] = entry } end |
#build ⇒ Object
17 18 19 |
# File 'lib/asciimath/color_table.rb', line 17 def build @table.dup.freeze end |