Class: RSpec::Multicore::ProxyIO

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/multicore/reporter_bridge.rb

Overview

Sends worker stdout and stderr through the same ordered event writer.

Instance Method Summary collapse

Constructor Details

#initialize(writer, stream) ⇒ ProxyIO

Returns a new instance of ProxyIO.



196
197
198
199
# File 'lib/rspec/multicore/reporter_bridge.rb', line 196

def initialize(writer, stream)
  @writer = writer
  @stream = stream
end

Instance Method Details

#<<(data) ⇒ Object



209
# File 'lib/rspec/multicore/reporter_bridge.rb', line 209

def <<(data) = write(data).then { self }

#closeObject



222
# File 'lib/rspec/multicore/reporter_bridge.rb', line 222

def close = nil

#closed?Boolean

Returns:

  • (Boolean)


223
# File 'lib/rspec/multicore/reporter_bridge.rb', line 223

def closed? = false

#flushObject



210
# File 'lib/rspec/multicore/reporter_bridge.rb', line 210

def flush = self


211
# File 'lib/rspec/multicore/reporter_bridge.rb', line 211

def print(*args) = args.each { write(_1) }.then { nil }

#printf(format, *args) ⇒ Object



212
# File 'lib/rspec/multicore/reporter_bridge.rb', line 212

def printf(format, *args) = write(format % args).then { nil }

#puts(*args) ⇒ Object



213
# File 'lib/rspec/multicore/reporter_bridge.rb', line 213

def puts(*args) = (args.empty? ? write("\n") : args.each { write("#{_1}\n") }).then { nil }

#syncObject



216
# File 'lib/rspec/multicore/reporter_bridge.rb', line 216

def sync = true

#sync=(_value) ⇒ Object



218
219
220
# File 'lib/rspec/multicore/reporter_bridge.rb', line 218

def sync=(_value)
  true
end

#tty?Boolean Also known as: isatty

Returns:

  • (Boolean)


214
# File 'lib/rspec/multicore/reporter_bridge.rb', line 214

def tty? = false

#write(data) ⇒ Object



201
202
203
204
205
206
207
# File 'lib/rspec/multicore/reporter_bridge.rb', line 201

def write(data)
  value = data.to_s
  return 0 if value.empty?

  @writer.emit(@stream, value)
  value.bytesize
end