class Neovim::RemoteObject
@abstract Superclass for all nvim
remote objects.
Attributes
index[R]
Public Class Methods
new(index, session, api)
click to toggle source
# File lib/neovim/remote_object.rb, line 12 def initialize(index, session, api) @index = index @session = session @api = api end
Public Instance Methods
==(other)
click to toggle source
Extend +==+ to only look at class and index.
# File lib/neovim/remote_object.rb, line 46 def ==(other) other.class.equal?(self.class) && @index == other.index end
method_missing(method_name, *args)
click to toggle source
Intercept method calls and delegate to appropriate RPC methods.
Calls superclass method
# File lib/neovim/remote_object.rb, line 27 def method_missing(method_name, *args) if (func = @api.function_for_object_method(self, method_name)) func.call(@session, @index, *args) else super end end
methods(*args)
click to toggle source
Extend methods
to include RPC methods
Calls superclass method
# File lib/neovim/remote_object.rb, line 41 def methods(*args) super | rpc_methods.to_a end
respond_to_missing?(method_name, *)
click to toggle source
Extend respond_to_missing?
to support RPC methods.
Calls superclass method
# File lib/neovim/remote_object.rb, line 36 def respond_to_missing?(method_name, *) super || rpc_methods.include?(method_name.to_sym) end
to_msgpack(packer)
click to toggle source
Serialize object to MessagePack.
@param packer [MessagePack::Packer] @return [String]
# File lib/neovim/remote_object.rb, line 22 def to_msgpack(packer) packer.pack(@index) end
Private Instance Methods
rpc_methods()
click to toggle source
# File lib/neovim/remote_object.rb, line 52 def rpc_methods @rpc_methods ||= @api.functions_for_object(self).map(&:method_name).to_set end