Module: Neovim::RubyProvider Private

Defined in:
lib/neovim/ruby_provider.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

This class is used to define a Neovim::Plugin to act as a backend for the :ruby, :rubyfile, and :rubydo Vim commands. It is autoloaded from nvim and not intended to be required directly.

Class Method Summary collapse

Class Method Details

.__define_plugin!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
18
19
20
21
22
23
# File 'lib/neovim/ruby_provider.rb', line 13

def self.__define_plugin!
  Thread.abort_on_exception = true

  Neovim.plugin do |plug|
    __define_setup(plug)
    __define_ruby_execute(plug)
    __define_ruby_execute_file(plug)
    __define_ruby_do_range(plug)
    __define_ruby_chdir(plug)
  end
end

.__define_setup(plug) ⇒ 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.

Define the DirChanged event to update the provider's pwd.


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/neovim/ruby_provider.rb', line 26

def self.__define_setup(plug)
  plug.__send__(:setup) do |client|
    begin
      cid = client.api.channel_id
      client.command("au DirChanged * call rpcrequest(#{cid}, 'ruby_chdir', v:event)")
    rescue ArgumentError
      # Swallow this exception for now. This means the nvim installation is
      # from before DirChanged was implemented.
    end
  end
end