class StateStore
Attributes
state_map[R]
Public Class Methods
new()
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 6 def initialize @state_map = {} end
Public Instance Methods
clear()
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 10 def clear @state_map = {} end
code_actions_for(uri, line_range)
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 36 def code_actions_for(uri, line_range) state = get(uri) return [] unless state state.code_actions(line_range) end
delete(uri)
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 14 def delete(uri) @state_map.delete(uri) [] end
get(uri)
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 23 def get(uri) @state_map[uri] end
set(uri:, text:, diagnostics: [])
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 19 def set(uri:, text:, diagnostics: []) @state_map[uri] = State.new(uri: uri, text: text, diagnostics: diagnostics || []) end
text_for(uri)
click to toggle source
# File lib/rubocop/lsp/state_store.rb, line 27 def text_for(uri) state = get(uri) return state.text if state file = CGI.unescape(URI.parse(uri).path) File.binread(file) end