Class: Neovim::Connection
- Includes:
- MPLight::Packer, MPLight::Unpacker, Logging
- Defined in:
- lib/neovim/connection.rb
Direct Known Subclasses
ConnectionChild, ConnectionStdio, ConnectionTcp, ConnectionUnix
Constant Summary
Constants included from Logging
Logging::DEFAULT_LEVEL, Logging::LEVELS
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #additional_data ⇒ Object
- #error(id) ⇒ Object
-
#initialize(rd, wr) ⇒ Connection
constructor
A new instance of Connection.
- #start(comm) ⇒ Object
Methods included from Logging
Constructor Details
#initialize(rd, wr) ⇒ Connection
Returns a new instance of Connection.
20 21 22 23 24 25 26 |
# File 'lib/neovim/connection.rb', line 20 def initialize rd, wr super default_to_string! init_input rd init_output wr @errors = {} end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/neovim/connection.rb', line 18 def client @client end |
Instance Method Details
#additional_data ⇒ Object
28 |
# File 'lib/neovim/connection.rb', line 28 def additional_data ; [ *super, @client] ; end |
#error(id) ⇒ Object
31 32 33 |
# File 'lib/neovim/connection.rb', line 31 def error id @errors[ id] || "Error #{id}" end |
#start(comm) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/neovim/connection.rb', line 36 def start comm comm.notify :nvim_set_client_info, comm.client_name, INFO.version_h, comm.client_type, comm.client_methods||{}, INFO.attributes channel_id, api_info = *(comm.request :nvim_get_api_info) @client = Client.new comm, channel_id prefixes = {} api_info[ "types"].each do |type,info| type = type.to_sym prefixes[ type] = /\A#{info[ "prefix"]}/ register_type type, info[ "id"] end @client.add_functions api_info[ "functions"], prefixes api_info[ "error_types"].each { |type,info| register_error type, info[ "id"] } nil end |