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.
58
59
60
|
# File 'lib/neovim/ruby_provider.rb', line 58
def initialize source
super *[]
end
|
Instance Method Details
#rpc(name) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/neovim/ruby_provider.rb', line 77
def rpc name
add_handler nil, name do |client,*args|
WriteOut.redirect client do
WriteErr.redirect client do
yield client, *args
end
end
rescue Exception
msg = $!.to_s
if msg =~ /\A.*?:(\d+):\s*/ then
line, msg = $1, $'
else
line = $@.first[ /:(\d+):in\b/, 1]
end
client.message_err "Ruby #{$!.class}:#{line}: #{msg}"
end
end
|
#setup(&block) ⇒ Object
62
63
64
|
# File 'lib/neovim/ruby_provider.rb', line 62
def setup &block
add_setup_block &block
end
|
#setup_autocmd(event, fn, *args) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/neovim/ruby_provider.rb', line 66
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
73
74
75
|
# File 'lib/neovim/ruby_provider.rb', line 73
def updater name, &block
add_handler nil, name, &block
end
|