Class: Neovim::WriteErr

Inherits:
Write show all
Defined in:
lib/neovim/output.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(*args, **kwargs) ⇒ Object



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

def redirect *args, **kwargs
  open *args, **kwargs do |i|
    old, $stderr = $stderr, i
    yield
  ensure
    $stderr = old
  end
end

Instance Method Details

#finishObject



135
136
137
138
139
140
# File 'lib/neovim/output.rb', line 135

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

#write(*args) ⇒ Object



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

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