Class: Tapioca::Compilers::SymbolTable::SymbolGenerator

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/tapioca/compilers/symbol_table/symbol_generator.rb

Constant Summary collapse

IGNORED_SYMBOLS =
%w{
  YAML
  MiniTest
  Mutex
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem, indent = 0) ⇒ SymbolGenerator

Returns a new instance of SymbolGenerator.



21
22
23
24
25
26
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 21

def initialize(gem, indent = 0)
  @gem = gem
  @indent = indent
  @seen = Set.new
  @alias_namespace ||= Set.new
end

Instance Attribute Details

#gemObject (readonly)

Returns the value of attribute gem.



18
19
20
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 18

def gem
  @gem
end

#indentObject (readonly)

Returns the value of attribute indent.



18
19
20
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 18

def indent
  @indent
end

Instance Method Details

#generateObject



29
30
31
32
33
34
35
36
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 29

def generate
  symbols
    .sort
    .map { |symbol| generate_from_symbol(symbol) }
    .compact
    .join("\n\n")
    .concat("\n")
end