class Solargraph::Pin::Closure
Attributes
@return [::Symbol] :class or :instance
Public Class Methods
Source
# File lib/solargraph/pin/closure.rb, line 12 def initialize scope: :class, generics: nil, generic_defaults: {}, **splat super(**splat) @scope = scope @generics = generics @generic_defaults = generic_defaults end
@param scope [::Symbol] :class or :instance @param generics [::Array<Pin::Parameter>, nil] @param generic_defaults [Hash{String => ComplexType}]
Calls superclass method
Solargraph::Pin::Base::new
Public Instance Methods
Source
# File lib/solargraph/pin/closure.rb, line 28 def combine_with(other, attrs={}) new_attrs = { scope: assert_same(other, :scope), generics: generics.empty? ? other.generics : generics, }.merge(attrs) super(other, new_attrs) end
@param other [self] @param attrs [Hash{Symbol => Object}]
@return [self]
Calls superclass method
Solargraph::Pin::Base#combine_with
Source
# File lib/solargraph/pin/closure.rb, line 36 def context @context ||= begin result = super if scope == :instance result.reduce_class_type else result end end end
Calls superclass method
Solargraph::Pin::Common#context
Source
# File lib/solargraph/pin/closure.rb, line 20 def generic_defaults @generic_defaults ||= {} end
@return [Hash{String => ComplexType}]
Source
# File lib/solargraph/pin/closure.rb, line 56 def generics @generics ||= docstring.tags(:generic).map(&:name) end
@return [::Array<String>]
Source
# File lib/solargraph/pin/closure.rb, line 65 def rbs_generics return '' if generics.empty? '[' + generics.map { |gen| gen.to_s }.join(', ') + '] ' end
@return [String]
Source
# File lib/solargraph/pin/closure.rb, line 53 def rebind api_map; end
@param api_map [Solargraph::ApiMap] @return [void]
Source
# File lib/solargraph/pin/closure.rb, line 60 def to_rbs rbs_generics + return_type.to_rbs end