Sha256: c933f2a5fb9c6d494cc3c4f8b7bb37410063cd4b4a7057d203601303d7b82559

Contents?: true

Size: 457 Bytes

Versions: 7

Compression:

Stored size: 457 Bytes

Contents

module AsciiMath
  class SymbolTableBuilder
    def initialize()
      @table = {}
    end

    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

    def build
      @table.dup.freeze
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
asciimath-2.0.4 lib/asciimath/symbol_table.rb
asciimath-2.0.3 lib/asciimath/symbol_table.rb
asciimath-2.0.2 lib/asciimath/symbol_table.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/asciimath-2.0.1/lib/asciimath/symbol_table.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/asciimath-2.0.1/lib/asciimath/symbol_table.rb
asciimath-2.0.1 lib/asciimath/symbol_table.rb
asciimath-2.0.0 lib/asciimath/symbol_table.rb