class AsciiMath::SymbolTableBuilder

Public Class Methods

new() click to toggle source
# File lib/asciimath/symbol_table.rb, line 3
def initialize()
  @table = {}
end

Public Instance Methods

add(*args) click to toggle source
# File lib/asciimath/symbol_table.rb, line 7
def add(*args)
  raise 'Insufficient arguments' if args.length < 3

  entry = {}
  if args.last.is_a?(Hash)
    entry.merge!(args.pop)
  end
  entry[:type] = args.pop
  entry[:value] = args.pop

  entry.freeze
  args.each { |name| @table[name.freeze] = entry }
end
build() click to toggle source
# File lib/asciimath/symbol_table.rb, line 21
def build
  @table.dup.freeze
end