Class: RbsActivesupport::MethodSearcher
- Inherits:
-
Object
- Object
- RbsActivesupport::MethodSearcher
- Defined in:
- lib/rbs_activesupport/method_searcher.rb
Instance Attribute Summary collapse
-
#rbs_builder ⇒ Object
readonly
: RBS::DefinitionBuilder.
Instance Method Summary collapse
-
#initialize(rbs_builder) ⇒ MethodSearcher
constructor
A new instance of MethodSearcher.
- #method_types_for(delegate) ⇒ Object
Constructor Details
#initialize(rbs_builder) ⇒ MethodSearcher
Returns a new instance of MethodSearcher.
10 11 12 |
# File 'lib/rbs_activesupport/method_searcher.rb', line 10 def initialize(rbs_builder) #: void @rbs_builder = rbs_builder end |
Instance Attribute Details
#rbs_builder ⇒ Object (readonly)
: RBS::DefinitionBuilder
7 8 9 |
# File 'lib/rbs_activesupport/method_searcher.rb', line 7 def rbs_builder @rbs_builder end |
Instance Method Details
#method_types_for(delegate) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rbs_activesupport/method_searcher.rb', line 15 def method_types_for(delegate) #: Array[String] delegate_to = lookup_method_types(delegate.namespace.to_type_name, delegate.to) return ["() -> untyped"] if delegate_to.any? { |t| t.type.return_type.is_a?(RBS::Types::Bases::Any) } return_types = return_type_names_for(delegate_to).uniq .flat_map { |t| lookup_method_types(t, delegate.method) } .map(&:to_s) return_types << "() -> untyped" if return_types.empty? return_types end |