Class: AsciiMath::ColorTableBuilder

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

Instance Method Summary collapse

Constructor Details

#initializeColorTableBuilder

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

#buildObject



17
18
19
# File 'lib/asciimath/color_table.rb', line 17

def build
  @table.dup.freeze
end