Class: Neovim::Host Private
- Inherits:
-
Object
- Object
- Neovim::Host
- Includes:
- Logging
- Defined in:
- lib/neovim/host.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
Classes: Loader
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
19 20 21 22 23 24 25 |
# File 'lib/neovim/host.rb', line 19 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.
11 12 13 |
# File 'lib/neovim/host.rb', line 11 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.
13 14 15 16 17 |
# File 'lib/neovim/host.rb', line 13 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.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/neovim/host.rb', line 31 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 #{message.method_name}: (#{e.class}) #{e.message}") 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.
27 28 29 |
# File 'lib/neovim/host.rb', line 27 def run @session.run { |msg| handle(msg) } end |