Class: Tapioca::Compilers::Forwardables
- Defined in:
- sorbet/tapioca/compilers/forwardables.rb
Constant Summary collapse
- FORWARDABLE_FILENAME =
"forwardable.rb"
- ARRAY_METHODS =
T.let(["to_a", "to_ary"].freeze, T::Array[String])
- HASH_METHODS =
T.let(["to_h", "to_hash"].freeze, T::Array[String])
- STRING_METHODS =
T.let(["to_s", "to_str", "to_json"].freeze, T::Array[String])
- ConstantType =
type_member { { fixed: Module } }
Class Method Summary collapse
Instance Method Summary collapse
- #decorate ⇒ void private
Class Method Details
.gather_constants ⇒ Enumerable<Module>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
19 20 21 22 23 24 |
# File 'sorbet/tapioca/compilers/forwardables.rb', line 19 def self.gather_constants Homebrew::Tapioca::Utils.named_objects_with_module(Forwardable).reject do |obj| # Avoid duplicate stubs for forwardables that are defined in vendored gems Object.const_source_location(T.must(obj.name))&.first&.include?("vendor/bundle/ruby") end end |
Instance Method Details
#decorate ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
27 28 29 30 31 32 33 34 |
# File 'sorbet/tapioca/compilers/forwardables.rb', line 27 def decorate root.create_path(constant) do |klass| Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME) .each { |method| compile_forwardable_method(klass, method) } Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME, class_methods: true) .each { |method| compile_forwardable_method(klass, method, class_method: true) } end end |