Class: Tapioca::Compilers::SymbolTable::SymbolGenerator
- Inherits:
-
Object
- Object
- Tapioca::Compilers::SymbolTable::SymbolGenerator
- Extended by:
- T::Sig
- Includes:
- Reflection
- Defined in:
- lib/tapioca/compilers/symbol_table/symbol_generator.rb
Constant Summary collapse
- IGNORED_SYMBOLS =
T.let(["YAML", "MiniTest", "Mutex"], T::Array[String])
- IGNORED_COMMENTS =
T.let([ ":doc:", ":nodoc:", "typed:", "frozen_string_literal:", "encoding:", "warn_indent:", "shareable_constant_value:", "rubocop:", ], T::Array[String])
Constants included from Reflection
Reflection::ANCESTORS_METHOD, Reflection::CLASS_METHOD, Reflection::CONSTANTS_METHOD, Reflection::EQUAL_METHOD, Reflection::METHOD_METHOD, Reflection::NAME_METHOD, Reflection::OBJECT_ID_METHOD, Reflection::PRIVATE_INSTANCE_METHODS_METHOD, Reflection::PROTECTED_INSTANCE_METHODS_METHOD, Reflection::PUBLIC_INSTANCE_METHODS_METHOD, Reflection::SINGLETON_CLASS_METHOD, Reflection::SUPERCLASS_METHOD
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(rbi) ⇒ Object
-
#initialize(gem, indent = 0, include_doc = false) ⇒ SymbolGenerator
constructor
A new instance of SymbolGenerator.
Methods included from Reflection
#ancestors_of, #are_equal?, #class_of, #constants_of, #descendants_of, #inherited_ancestors_of, #method_of, #name_of_type, #object_id_of, #private_instance_methods_of, #protected_instance_methods_of, #public_instance_methods_of, #qualified_name_of, #signature_of, #singleton_class_of, #superclass_of
Constructor Details
#initialize(gem, indent = 0, include_doc = false) ⇒ SymbolGenerator
Returns a new instance of SymbolGenerator.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 32 def initialize(gem, indent = 0, include_doc = false) @gem = gem @indent = indent @seen = T.let(Set.new, T::Set[String]) @alias_namespace = T.let(Set.new, T::Set[String]) @symbol_queue = T.let(symbols.sort.dup, T::Array[String]) @symbols = T.let(nil, T.nilable(T::Set[String])) @include_doc = include_doc gem.parse_yard_docs if include_doc end |
Instance Attribute Details
#gem ⇒ Object (readonly)
Returns the value of attribute gem.
26 27 28 |
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 26 def gem @gem end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
29 30 31 |
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 29 def indent @indent end |
Instance Method Details
#generate(rbi) ⇒ Object
45 46 47 |
# File 'lib/tapioca/compilers/symbol_table/symbol_generator.rb', line 45 def generate(rbi) generate_from_symbol(rbi.root, T.must(@symbol_queue.shift)) until @symbol_queue.empty? end |