Class: Neovim::DslProvider
Constant Summary
collapse
- TYPE =
:script
Constants included
from Logging
Logging::DEFAULT_LEVEL, Logging::LEVELS
Instance Method Summary
collapse
Methods inherited from DslBase
#mkplugin, open
Methods included from Logging
put
Constructor Details
Returns a new instance of DslProvider.
59
60
61
|
# File 'lib/neovim/ruby_provider.rb', line 59
def initialize source
super *[]
end
|
Instance Method Details
#rpc(name) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/neovim/ruby_provider.rb', line 78
def rpc name
add_handler nil, name do |client,*args|
WriteOut.redirect client do
WriteErr.redirect client do
yield client, *args
end
end
rescue ScriptError, StandardError
line = $@.first[ /:(\d+):/, 1]
client.err_writeln "Ruby #$! (#{$!.class}), line #{line}"
end
end
|
#setup(&block) ⇒ Object
63
64
65
|
# File 'lib/neovim/ruby_provider.rb', line 63
def setup &block
add_setup_block &block
end
|
#setup_autocmd(event, fn, *args) ⇒ Object
67
68
69
70
71
72
|
# File 'lib/neovim/ruby_provider.rb', line 67
def setup_autocmd event, fn, *args
add_setup_block do |client|
a = [ client.channel_id, "'#{fn}'", *args].join ", "
client.command "autocmd #{event} * call rpcrequest(#{a})"
end
end
|
#updater(name, &block) ⇒ Object
74
75
76
|
# File 'lib/neovim/ruby_provider.rb', line 74
def updater name, &block
add_handler nil, name, &block
end
|