Class: Neovim::WriteErr

Inherits:
Write show all
Defined in:
lib/neovim/ruby_provider.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Write

#flush, #initialize, open, #print, #puts

Constructor Details

This class inherits a constructor from Neovim::Write

Class Method Details

.redirect(client) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/neovim/ruby_provider.rb', line 114

def redirect client
  open client do |i|
    old, $stderr = $stderr, i
    yield
  ensure
    $stderr = old
  end
end

Instance Method Details

#finishObject



134
135
136
137
138
139
# File 'lib/neovim/ruby_provider.rb', line 134

def finish
  if @rest.notempty? then
    @client.err_writeln @rest
    @rest = nil
  end
end

#write(*args) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
# File 'lib/neovim/ruby_provider.rb', line 123

def write *args
  args.each { |a|
    @rest ||= ""
    @rest << a
    while @rest =~ /#$// do
      @client.err_writeln $`
      @rest = $'
    end
  }
  nil
end