Class: Neovim::API::Function

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

Overview

Encapsulate an RPC function.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#asyncObject

Returns the value of attribute async

Returns:

  • (Object)

    the current value of async



68
69
70
# File 'lib/neovim/api.rb', line 68

def async
  @async
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



68
69
70
# File 'lib/neovim/api.rb', line 68

def name
  @name
end

Instance Method Details

#call(session, *args) ⇒ Object?

Apply this function to a running RPC session. Sends either a request if async is false or a notification if async is true.

Parameters:

  • session (Session)

    The session to apply the function to.

  • *args (Array)

    Arguments to the function.

Returns:

  • (Object, nil)


75
76
77
78
79
80
81
# File 'lib/neovim/api.rb', line 75

def call(session, *args)
  if async
    session.notify(name, *args)
  else
    session.request(name, *args)
  end
end