Class: Solargraph::Pin::Closure
- Defined in:
- lib/solargraph/pin/closure.rb
Instance Attribute Summary collapse
-
#scope ⇒ ::Symbol
readonly
:class or :instance.
Attributes inherited from Base
#code_object, #location, #name, #path, #return_type
Attributes included from Common
Instance Method Summary collapse
- #binder ⇒ Object
- #context ⇒ Object
- #gates ⇒ Array<String>
-
#initialize(scope: :class, **splat) ⇒ Closure
constructor
A new instance of Closure.
Methods inherited from Base
#==, #comments, #completion_item_kind, #deprecated?, #directives, #docstring, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #probe, #probed?, #proxied?, #proxy, #realize, #symbol_kind, #to_s, #try_merge!, #typify, #variable?
Methods included from Documenting
Methods included from Conversions
#completion_item, #detail, #link_documentation, #reset_conversions, #resolve_completion_item, #signature_help, #text_documentation
Methods included from Common
#comments, #name, #namespace, #path, #return_type
Constructor Details
#initialize(scope: :class, **splat) ⇒ Closure
Returns a new instance of Closure.
9 10 11 12 |
# File 'lib/solargraph/pin/closure.rb', line 9 def initialize scope: :class, **splat super(**splat) @scope = scope end |
Instance Attribute Details
#scope ⇒ ::Symbol (readonly)
Returns :class or :instance.
7 8 9 |
# File 'lib/solargraph/pin/closure.rb', line 7 def scope @scope end |
Instance Method Details
#binder ⇒ Object
25 26 27 |
# File 'lib/solargraph/pin/closure.rb', line 25 def binder @binder || context end |
#context ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/solargraph/pin/closure.rb', line 14 def context @context ||= begin result = super if scope == :instance Solargraph::ComplexType.parse(result.namespace) else result end end end |
#gates ⇒ Array<String>
30 31 32 33 34 |
# File 'lib/solargraph/pin/closure.rb', line 30 def gates # @todo This check might not be necessary. There should always be a # root pin closure ? closure.gates : [''] end |