Class: Neovim::Remote

Inherits:
Session show all
Defined in:
lib/neovim/remote.rb

Direct Known Subclasses

Host

Constant Summary

Constants included from Logging

Logging::DEFAULT_LEVEL, Logging::LEVELS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Session

#notify, open, #request, #run, start

Methods included from Logging

put

Constructor Details

#initialize(conn) ⇒ Remote

Returns a new instance of Remote.



23
24
25
26
# File 'lib/neovim/remote.rb', line 23

def initialize conn
  super
  @plugins = {}
end

Class Method Details

.start_client(*args) ⇒ Object



15
16
17
18
19
# File 'lib/neovim/remote.rb', line 15

def start_client *args
  start *args do |i|
    yield i.start
  end
end

Instance Method Details

#add_plugins(source, plugins) ⇒ Object



37
38
39
# File 'lib/neovim/remote.rb', line 37

def add_plugins source, plugins
  @plugins[ source] = plugins
end

#client_methodsObject



34
# File 'lib/neovim/remote.rb', line 34

def client_methods ;                 end

#client_nameObject



33
# File 'lib/neovim/remote.rb', line 33

def client_name    ; "ruby-client" ; end

#execute_handler(name, args) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/neovim/remote.rb', line 41

def execute_handler name, args
  @plugins.each_value do |plugin|
    handler = plugin.get_handler name
    if handler then
      log :info, "Found handler", name: name
      log :debug1, "Calling with", args: args
      return handler.execute @conn.client, *args
    end
  end
  super
end

#startObject



28
29
30
31
# File 'lib/neovim/remote.rb', line 28

def start
  @conn.start @comm, client_name, self.class.name.downcase.to_sym, client_methods
  @conn.client
end