Class: Mutant::AST::Regexp::Transformer::LookupTable::Table Private
- Inherits:
-
Object
- Object
- Mutant::AST::Regexp::Transformer::LookupTable::Table
- Includes:
- Unparser::Adamantium
- Defined in:
- lib/mutant/ast/regexp/transformer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Table mapping ast types to object information for regexp domain
Class Method Summary collapse
-
.create(*rows) ⇒ Table
private
Coerce array of mapping information into structured table.
Instance Method Summary collapse
-
#lookup(type) ⇒ Mapping
private
Lookup mapping information given an ast node type.
-
#types ⇒ Array<Symbol>
private
Types defined by the table.
Class Method Details
.create(*rows) ⇒ Table
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Coerce array of mapping information into structured table
112 113 114 115 116 117 118 |
# File 'lib/mutant/ast/regexp/transformer.rb', line 112 def self.create(*rows) table = rows.to_h do |ast_type, token, klass| [ast_type, Mapping.new(::Regexp::Token.new(*token), klass)] end new(table) end |
Instance Method Details
#lookup(type) ⇒ Mapping
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lookup mapping information given an ast node type
134 135 136 |
# File 'lib/mutant/ast/regexp/transformer.rb', line 134 def lookup(type) table.fetch(type) end |
#types ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Types defined by the table
125 126 127 |
# File 'lib/mutant/ast/regexp/transformer.rb', line 125 def types table.keys end |