Class: Standard::Lsp::Routes
- Inherits:
-
Object
- Object
- Standard::Lsp::Routes
- Defined in:
- lib/standard/lsp/routes.rb
Constant Summary collapse
- CONFIGURATION_FILE_PATTERNS =
[ ".standard.yml", ".standard_todo.yml" ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #for(name) ⇒ Object
- #handle_method_missing(request) ⇒ Object
- #handle_unsupported_method(request, method = ) ⇒ Object
-
#initialize(writer, logger, standardizer) ⇒ Routes
constructor
A new instance of Routes.
Constructor Details
#initialize(writer, logger, standardizer) ⇒ Routes
Returns a new instance of Routes.
6 7 8 9 10 11 12 13 |
# File 'lib/standard/lsp/routes.rb', line 6 def initialize(writer, logger, standardizer) @writer = writer @logger = logger @standardizer = standardizer @text_cache = {} @kills_server = KillsServer.new end |
Class Method Details
.handle(name, &block) ⇒ Object
15 16 17 |
# File 'lib/standard/lsp/routes.rb', line 15 def self.handle(name, &block) define_method(:"handle_#{name}", &block) end |
Instance Method Details
#for(name) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/standard/lsp/routes.rb', line 19 def for(name) name = "handle_#{name}" if respond_to?(name) method(name) end end |
#handle_method_missing(request) ⇒ Object
129 130 131 132 133 |
# File 'lib/standard/lsp/routes.rb', line 129 def handle_method_missing(request) if request.key?(:id) @writer.write({id: request[:id], result: nil}) end end |
#handle_unsupported_method(request, method = ) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/standard/lsp/routes.rb', line 121 def handle_unsupported_method(request, method = request[:method]) @writer.write({id: request[:id], error: Proto::Interface::ResponseError.new( code: Proto::Constant::ErrorCodes::METHOD_NOT_FOUND, message: "Unsupported Method: #{method}" )}) @logger.puts "Unsupported Method: #{method}" end |