Class: Solargraph::Pin::MethodAlias
- Inherits:
-
Method
- Object
- Pin::Base
- CompoundStatement
- Closure
- Callable
- Method
- Solargraph::Pin::MethodAlias
- Defined in:
- lib/solargraph/pin/method_alias.rb
Overview
Use this class to track method aliases for later remapping. Common examples that defer mapping are aliases for superclass methods or methods from included modules.
Instance Attribute Summary collapse
- #original ⇒ String readonly
- #scope ⇒ ::Symbol readonly
Attributes inherited from Method
#block, #documentation, #node, #return_type, #signature_help, #signatures
Attributes inherited from Callable
#block, #parameters, #return_type
Attributes inherited from CompoundStatement
Instance Method Summary collapse
-
#initialize(scope: :instance, original: nil, **splat) ⇒ MethodAlias
constructor
A new instance of MethodAlias.
- #path ⇒ Object
- #to_rbs ⇒ Object
- #visibility ⇒ Object
Methods inherited from Method
#==, #all_rooted?, #anon_splat?, #attribute?, #block?, #combine_visibility, #combine_with, #completion_item_kind, #detail, #explicit?, #generate_signature, #inner_desc, #method_name, #nearly?, #overloads, #probe, #proxy_with_signatures, #reset_generated!, #resolve_ref_tag, #rest_of_stack, #symbol_kind, #transform_types, #typify, #with_single_signature
Methods inherited from Callable
#arity, #arity_matches?, #block?, #blockless_parameters, #choose_parameters, #combine_blocks, #combine_with, #full_type_arity, #generics, #mandatory_positional_param_count, #method_name, #method_namespace, #parameter_names, #parameters_to_rbs, #reset_generated!, #resolve_generics_from_context, #resolve_generics_from_context_until_complete, #transform_types, #type_arity, #typify
Methods inherited from Closure
#combine_with, #context, #generic_defaults, #generics, #rbs_generics, #rebind
Constructor Details
#initialize(scope: :instance, original: nil, **splat) ⇒ MethodAlias
Returns a new instance of MethodAlias.
19 20 21 22 23 |
# File 'lib/solargraph/pin/method_alias.rb', line 19 def initialize scope: :instance, original: nil, **splat super(**splat) @scope = scope @original = original end |
Instance Attribute Details
#original ⇒ String (readonly)
14 15 16 |
# File 'lib/solargraph/pin/method_alias.rb', line 14 def original @original end |
#scope ⇒ ::Symbol (readonly)
11 12 13 |
# File 'lib/solargraph/pin/method_alias.rb', line 11 def scope @scope end |
Instance Method Details
#path ⇒ Object
37 38 39 |
# File 'lib/solargraph/pin/method_alias.rb', line 37 def path @path ||= namespace + (scope == :instance ? '#' : '.') + name end |
#to_rbs ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/solargraph/pin/method_alias.rb', line 29 def to_rbs if scope == :class "alias self.#{name} self.#{original}" else "alias #{name} #{original}" end end |
#visibility ⇒ Object
25 26 27 |
# File 'lib/solargraph/pin/method_alias.rb', line 25 def visibility :public end |