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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/neovim/ruby_provider.rb', line 14

def self.__define_plugin!
  Thread.abort_on_exception = true

  Neovim.plugin do |plug|
    plug.__send__(:script_host!)

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



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/neovim/ruby_provider.rb', line 30

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