Class: Neovim::API Private

Inherits:
Object
  • Object
show all
Defined in:
lib/neovim/api.rb

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

Defined Under Namespace

Classes: Function

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ API

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.

Returns a new instance of API


6
7
8
# File 'lib/neovim/api.rb', line 6

def initialize(payload)
  @channel_id, @api_info = payload
end

Instance Attribute Details

#channel_idObject (readonly)

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.


4
5
6
# File 'lib/neovim/api.rb', line 4

def channel_id
  @channel_id
end

Instance Method Details

#function_for_object_method(obj, method_name) ⇒ 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.


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

def function_for_object_method(obj, method_name)
  functions[function_name(obj, method_name)]
end

#functionsObject

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.

Return all functions defined by the API.


11
12
13
14
15
16
# File 'lib/neovim/api.rb', line 11

def functions
  @functions ||= @api_info.fetch("functions").inject({}) do |acc, func|
    function = Function.new(func)
    acc.merge(function.name => function)
  end
end

#functions_for_object(obj) ⇒ 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.


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

def functions_for_object(obj)
  pattern = function_pattern(obj)
  functions.values.select { |func| func.name =~ pattern }
end

#inspectObject

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.

Truncate the output of inspect so console sessions are more pleasant.


34
35
36
# File 'lib/neovim/api.rb', line 34

def inspect
  format("#<#{self.class}:0x%x @channel_id=#{@channel_id.inspect}>", object_id << 1)
end

#typesObject

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.

Return information about nvim types. Used for registering MessagePack ext types.


20
21
22
# File 'lib/neovim/api.rb', line 20

def types
  @types ||= @api_info.fetch("types")
end