Class: Solargraph::Plugin::Process
- Inherits:
-
Object
- Object
- Solargraph::Plugin::Process
- Defined in:
- lib/solargraph/plugin/process.rb
Instance Method Summary collapse
-
#initialize ⇒ Process
constructor
A new instance of Process.
- #post_initialize ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ Process
Returns a new instance of Process.
6 7 8 9 |
# File 'lib/solargraph/plugin/process.rb', line 6 def initialize @required = [] post_initialize end |
Instance Method Details
#post_initialize ⇒ Object
11 12 |
# File 'lib/solargraph/plugin/process.rb', line 11 def post_initialize end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/solargraph/plugin/process.rb', line 14 def run until STDIN.closed? input = gets break if input.nil? args = nil begin args = JSON.parse(input) case args['command'] when 'require' STDOUT.puts do_require args['paths'] when 'methods' STDOUT.puts get_methods args['params'] when 'constants' STDOUT.puts get_constants args['params'] when 'fqns' STDOUT.puts get_fqns args['params'] else STDOUT.puts respond_err "Unrecognized command #{args['command']}" end rescue JSON::ParserError => e STDOUT.puts respond_err "Error parsing input: #{e.message}" end STDOUT.flush end end |