Class: Neovim::WriteStd
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Write
#<<, #flush, open, #print, #puts
Constructor Details
#initialize(*args) ⇒ WriteStd
Returns a new instance of WriteStd.
93
94
95
96
|
# File 'lib/neovim/output.rb', line 93
def initialize *args
super
@str = ""
end
|
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, $stdout = $stdout, i
yield
ensure
$stdout = old
end
end
|
Instance Method Details
107
108
109
110
111
112
|
# File 'lib/neovim/output.rb', line 107
def finish
if @str.notempty? then
write_line @str
@str = nil
end
end
|
#write(*args) ⇒ Object
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/neovim/output.rb', line 97
def write *args
args.each { |a| @str << a.to_s }
loop do
l, r = @str.split $/, 2
r or break
write_line l
@str = r
end
nil
end
|