class Neovim::Host::Loader

@api private

Public Class Methods

new(host) click to toggle source
# File lib/neovim/host/loader.rb, line 7
def initialize(host)
  @host = host
end

Public Instance Methods

load(paths) click to toggle source
# File lib/neovim/host/loader.rb, line 11
def load(paths)
  paths.each do |path|
    override_plugin_method(path) do
      Kernel.load(path, true)
    end
  end
end

Private Instance Methods

override_plugin_method(path) { || ... } click to toggle source
# File lib/neovim/host/loader.rb, line 21
def override_plugin_method(path)
  old_plugin_def = Neovim.method(:plugin)
  at_host = @host

  Neovim.define_singleton_method(:plugin) do |&block|
    plugin = Plugin.from_config_block(path, &block)
    at_host.plugins << plugin
  end

  yield
ensure
  Neovim.define_singleton_method(:plugin, &old_plugin_def)
end