Class: Neovim::Host Private
- Includes:
- Logging
- Defined in:
- lib/neovim/host.rb,
lib/neovim/host/cli.rb,
lib/neovim/host/loader.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
- #plugins ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #handle(message) ⇒ Object private
-
#initialize(event_loop) ⇒ Host
constructor
private
A new instance of Host.
- #run ⇒ Object private
Methods included from Logging
Constructor Details
#initialize(event_loop) ⇒ Host
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Host.
20 21 22 23 24 25 26 |
# File 'lib/neovim/host.rb', line 20 def initialize(event_loop) @event_loop = event_loop @session = Session.new(event_loop) @handlers = {"poll" => poll_handler, "specs" => specs_handler} @plugins = [] @specs = {} end |
Instance Attribute Details
#plugins ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/neovim/host.rb', line 12 def plugins @plugins end |
Class Method Details
.run(rplugin_paths, event_loop = EventLoop.stdio) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 |
# File 'lib/neovim/host.rb', line 14 def self.run(rplugin_paths, event_loop=EventLoop.stdio) new(event_loop).tap do |host| Loader.new(host).load(rplugin_paths) end.run end |
Instance Method Details
#handle(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/neovim/host.rb', line 32 def handle() log(:debug) { .to_h } @handlers .fetch(.method_name, default_handler) .call(@client, ) rescue Exception => e log_exception(:error, e, __method__) if .sync? @session.respond(.id, nil, e.) else @client.err_writeln("Exception handling #{.method_name}: (#{e.class}) #{e.}") end raise unless e.is_a?(StandardError) end |
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/neovim/host.rb', line 28 def run @session.run { |msg| handle(msg) } end |