Class: Solargraph::Pin::MethodParameter
- Inherits:
-
LocalVariable
- Object
- Base
- BaseVariable
- LocalVariable
- Solargraph::Pin::MethodParameter
- Defined in:
- lib/solargraph/pin/method_parameter.rb
Instance Attribute Summary
Attributes included from Localized
Attributes inherited from BaseVariable
Attributes inherited from Base
#kind, #location, #name, #namespace, #path
Instance Method Summary collapse
-
#index ⇒ Integer
The parameter’s zero-based location in the block’s signature.
- #return_complex_type ⇒ Object
- #try_merge!(pin) ⇒ Object
Methods inherited from LocalVariable
Methods included from Localized
Methods inherited from BaseVariable
#==, #completion_item_kind, #infer, #initialize, #nil_assignment?, #signature, #symbol_kind, #variable?
Methods included from Source::NodeMethods
const_from, drill_signature, get_node_end_position, get_node_start_position, infer_literal_node_type, pack_name, resolve_node_signature, returns_from, unpack_name
Methods inherited from Base
#==, #comments, #completion_item_kind, #context, #deprecated?, #directives, #docstring, #filename, #infer, #initialize, #macros, #maybe_directives?, #nearly?, #return_type, #symbol_kind, #to_s, #variable?
Methods included from Documenting
Methods included from Conversions
#completion_item, #detail, #link_documentation, #reset_conversions, #resolve_completion_item, #signature_help
Constructor Details
This class inherits a constructor from Solargraph::Pin::LocalVariable
Instance Method Details
#index ⇒ Integer
The parameter’s zero-based location in the block’s signature.
26 27 28 |
# File 'lib/solargraph/pin/method_parameter.rb', line 26 def index block.parameter_names.index(name) end |
#return_complex_type ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/solargraph/pin/method_parameter.rb', line 4 def return_complex_type if @return_complex_type.nil? @return_complex_type = ComplexType.new found = nil params = block.docstring.(:param) params.each do |p| next unless p.name == name found = p break end if found.nil? and !index.nil? found = params[index] if params[index] && (params[index].name.nil? || params[index].name.empty?) end @return_complex_type = ComplexType.parse(*found.types) unless found.nil? or found.types.nil? end super @return_complex_type end |
#try_merge!(pin) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/solargraph/pin/method_parameter.rb', line 30 def try_merge! pin return false unless super # @todo This is a little expensive, but it's necessary because # parameter data depends on the method's docstring. @return_complex_type = pin.return_complex_type reset_conversions true end |