Class: Solargraph::Pin::FactoryParameter
- Defined in:
- lib/solargraph/pin/factory_parameter.rb
Overview
A method parameter with a literal value used in a factory method.
Constant Summary
Constants included from Logging
Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS
Instance Attribute Summary collapse
-
#decl ⇒ ::Symbol
readonly
:arg, :optarg, :kwarg, :kwoptarg, :restarg, :kwrestarg, :block, :blockarg.
- #location ⇒ Location? readonly
- #method_name ⇒ String readonly
- #method_namespace ⇒ String readonly
-
#method_scope ⇒ Symbol
readonly
:class or :instance.
- #param_name ⇒ String? readonly
-
#value ⇒ ::String, ::Symbol
readonly
The literal value.
Attributes inherited from Base
#code_object, #combine_priority, #directives, #docstring, #path, #return_type, #source, #type_location
Attributes included from Common
Instance Method Summary collapse
-
#initialize(method_name:, method_namespace:, method_scope:, param_name:, value:, return_type:, decl: :arg, location: nil) ⇒ FactoryParameter
constructor
A new instance of FactoryParameter.
- #method_path ⇒ String
- #name ⇒ Object
- #text_documentation ⇒ Object
Methods inherited from Base
#==, #all_location_text, #all_rooted?, #assert_location_provided, #assert_same, #assert_same_array_content, #assert_same_count, #assert_same_macros, #assert_source_provided, #best_location, #choose, #choose_longer, #choose_node, #choose_pin_attr, #choose_pin_attr_with_same_name, #choose_priority, #closure, #combine_closure, #combine_directives, #combine_name, #combine_return_type, #combine_with, #comments, #completion_item_kind, #deprecated?, #desc, #dodgy_return_type_source?, #erase_generics, #filename, #gates, #identity, #infer, #inspect, #macro_names, #macro_names?, #macros, #macros_names?, #maybe_directives?, #maybe_macros?, #nearly?, #needs_consistent_name?, #prefer_rbs_location, #presence_certain?, #probe, #probed?, #proxied?, #proxy, #rbs_location?, #realize, #reset_generated!, #resolve_generics, #resolve_generics_from_context, #symbol_kind, #to_rbs, #to_s, #transform_types, #type_desc, #typify, #variable?
Methods included from Logging
Methods included from Documenting
#documentation, normalize_indentation, strip_html_comments
Methods included from Conversions
#completion_item, #completion_item_kind, #deprecated?, #detail, #link_documentation, #probed?, #proxied?, #reset_conversions, #resolve_completion_item, #signature_help
Methods included from Common
#binder, #closure, #closure=, #comments, #each_closure, #namespace, #path, #reset_generated!, #return_type, #source
Constructor Details
#initialize(method_name:, method_namespace:, method_scope:, param_name:, value:, return_type:, decl: :arg, location: nil) ⇒ FactoryParameter
Returns a new instance of FactoryParameter.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 43 def initialize method_name:, method_namespace:, method_scope:, param_name:, value:, return_type:, decl: :arg, location: nil super(location: location) @method_name = method_name @method_namespace = method_namespace @method_scope = method_scope @param_name = param_name @value = value @decl = decl @return_type = return_type end |
Instance Attribute Details
#decl ⇒ ::Symbol (readonly)
Returns :arg, :optarg, :kwarg, :kwoptarg, :restarg, :kwrestarg, :block, :blockarg.
31 32 33 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 31 def decl @decl end |
#location ⇒ Location? (readonly)
33 34 35 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 33 def location @location end |
#method_name ⇒ String (readonly)
21 22 23 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 21 def method_name @method_name end |
#method_namespace ⇒ String (readonly)
23 24 25 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 23 def method_namespace @method_namespace end |
#method_scope ⇒ Symbol (readonly)
Returns :class or :instance.
25 26 27 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 25 def method_scope @method_scope end |
#param_name ⇒ String? (readonly)
27 28 29 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 27 def param_name @param_name end |
#value ⇒ ::String, ::Symbol (readonly)
Returns The literal value.
29 30 31 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 29 def value @value end |
Instance Method Details
#method_path ⇒ String
70 71 72 73 74 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 70 def method_path # @sg-ignore false failure on method_scope "Wrong argument type for Solargraph::Pin::Base#==: other expected # Solargraph::Pin::Base, received :instance" @method_path ||= "#{method_namespace}#{method_scope == :instance ? '#' : '.'}#{method_name}" end |
#name ⇒ Object
61 62 63 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 61 def name param_name end |
#text_documentation ⇒ Object
65 66 67 |
# File 'lib/solargraph/pin/factory_parameter.rb', line 65 def text_documentation "#{method_path}(#{param_name}) = #{value.inspect}" end |