Class: RubyLsp::Store
- Inherits:
-
Object
- Object
- RubyLsp::Store
- Extended by:
- T::Sig
- Defined in:
- lib/ruby_lsp/store.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
writeonly
Sets the attribute encoding.
Instance Method Summary collapse
- #cache_fetch(uri, request_name, &block) ⇒ Object
- #clear ⇒ Object
- #delete(uri) ⇒ Object
- #empty? ⇒ Boolean
- #get(uri) ⇒ Object
-
#initialize ⇒ Store
constructor
A new instance of Store.
- #push_edits(uri, edits) ⇒ Object
- #set(uri, content) ⇒ Object
Constructor Details
Instance Attribute Details
#encoding=(value) ⇒ Object (writeonly)
Sets the attribute encoding
13 14 15 |
# File 'lib/ruby_lsp/store.rb', line 13 def encoding=(value) @encoding = value end |
Instance Method Details
#cache_fetch(uri, request_name, &block) ⇒ Object
64 65 66 |
# File 'lib/ruby_lsp/store.rb', line 64 def cache_fetch(uri, request_name, &block) get(uri).cache_fetch(request_name, &block) end |
#clear ⇒ Object
42 43 44 |
# File 'lib/ruby_lsp/store.rb', line 42 def clear @state.clear end |
#delete(uri) ⇒ Object
52 53 54 |
# File 'lib/ruby_lsp/store.rb', line 52 def delete(uri) @state.delete(uri) end |
#empty? ⇒ Boolean
47 48 49 |
# File 'lib/ruby_lsp/store.rb', line 47 def empty? @state.empty? end |
#get(uri) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ruby_lsp/store.rb', line 22 def get(uri) document = @state[uri] return document unless document.nil? set(uri, File.binread(CGI.unescape(URI.parse(uri).path))) T.must(@state[uri]) end |
#push_edits(uri, edits) ⇒ Object
37 38 39 |
# File 'lib/ruby_lsp/store.rb', line 37 def push_edits(uri, edits) T.must(@state[uri]).push_edits(edits) end |