Class: Tapioca::Compilers::SymbolTable::SymbolGenerator
- Inherits:
-
Object
- Object
- Tapioca::Compilers::SymbolTable::SymbolGenerator
- 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
-
#gem ⇒ Object
readonly
Returns the value of attribute gem.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(gem, indent = 0) ⇒ SymbolGenerator
constructor
A new instance of SymbolGenerator.
Constructor Details
#initialize(gem, indent = 0) ⇒ SymbolGenerator
Returns a new instance of SymbolGenerator.
21 22 23 24 25 26 27 |
# 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 @symbol_queue = T.let(symbols.sort.dup, T::Array[String]) end |
Instance Attribute Details
#gem ⇒ Object (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 |
#indent ⇒ Object (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
#generate ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 30 def generate rbi = RBI::Tree.new generate_from_symbol(rbi, T.must(@symbol_queue.shift)) until @symbol_queue.empty? rbi.nest_singleton_methods! rbi.nest_non_public_methods! rbi.group_nodes! rbi.sort_nodes! rbi.string end |