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



84
85
86
87
88
89
90
91
# File 'lib/neovim/output.rb', line 84

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

Instance Method Details

#finishObject



104
105
106
107
108
109
# File 'lib/neovim/output.rb', line 104

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

#write(*args) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/neovim/output.rb', line 93

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