class Mutest::AST::Regexp::Transformer::LookupTable::Table

Table mapping ast types to object information for regexp domain

Public Class Methods

create(*rows) click to toggle source

Coerce array of mapping information into structured table

@param [Array(Symbol, Array, Class<Regexp::Expression>)]

@return [Table]

# File lib/mutest/ast/regexp/transformer.rb, line 145
def self.create(*rows)
  table = rows.map do |ast_type, token, klass|
    [ast_type, Mapping.new(::Regexp::Token.new(*token), klass)]
  end.to_h

  new(table)
end

Public Instance Methods

lookup(type) click to toggle source

Lookup mapping information given an ast node type

@param type [Symbol]

@return [Mapping]

# File lib/mutest/ast/regexp/transformer.rb, line 168
def lookup(type)
  table.fetch(type)
end
types() click to toggle source

Types defined by the table

@return [Array<Symbol>]

# File lib/mutest/ast/regexp/transformer.rb, line 159
def types
  table.keys
end