Class: RSpec::Interactive::ThreadedOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-interactive/threaded_output.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(thread_map:, default:) ⇒ ThreadedOutput

Returns a new instance of ThreadedOutput.



6
7
8
9
10
# File 'lib/rspec-interactive/threaded_output.rb', line 6

def initialize(thread_map:, default:)
  @thread_map = thread_map
  @default = default
  @string = ''
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



4
5
6
# File 'lib/rspec-interactive/threaded_output.rb', line 4

def string
  @string
end

Instance Method Details

#closeObject



40
41
42
# File 'lib/rspec-interactive/threaded_output.rb', line 40

def close
  (@thread_map[Thread.current] || @default).close
end

#closed?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rspec-interactive/threaded_output.rb', line 28

def closed?
  (@thread_map[Thread.current] || @default).closed?
end

#flushObject



24
25
26
# File 'lib/rspec-interactive/threaded_output.rb', line 24

def flush
  (@thread_map[Thread.current] || @default).flush
end


20
21
22
# File 'lib/rspec-interactive/threaded_output.rb', line 20

def print(str = "")
  (@thread_map[Thread.current] || @default).puts(str)
end

#puts(str = "") ⇒ Object



16
17
18
# File 'lib/rspec-interactive/threaded_output.rb', line 16

def puts(str = "")
  (@thread_map[Thread.current] || @default).puts(str)
end

#syncObject



36
37
38
# File 'lib/rspec-interactive/threaded_output.rb', line 36

def sync
  (@thread_map[Thread.current] || @default).sync
end

#sync=(sync) ⇒ Object



32
33
34
# File 'lib/rspec-interactive/threaded_output.rb', line 32

def sync=(sync)
  (@thread_map[Thread.current] || @default).sync = sync
end

#write(name, str = "") ⇒ Object



12
13
14
# File 'lib/rspec-interactive/threaded_output.rb', line 12

def write(name, str = "")
  (@thread_map[Thread.current] || @default).write(name, str)
end