Class: RSpec::Interactive::ThreadedOutput
- Inherits:
-
Object
- Object
- RSpec::Interactive::ThreadedOutput
- Defined in:
- lib/rspec-interactive/threaded_output.rb
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #flush ⇒ Object
-
#initialize(thread_map:, default:) ⇒ ThreadedOutput
constructor
A new instance of ThreadedOutput.
- #print(str = "") ⇒ Object
- #puts(str = "") ⇒ Object
- #sync ⇒ Object
- #sync=(sync) ⇒ Object
- #write(name, str = "") ⇒ Object
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
#string ⇒ Object (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
#close ⇒ Object
40 41 42 |
# File 'lib/rspec-interactive/threaded_output.rb', line 40 def close (@thread_map[Thread.current] || @default).close end |
#closed? ⇒ Boolean
28 29 30 |
# File 'lib/rspec-interactive/threaded_output.rb', line 28 def closed? (@thread_map[Thread.current] || @default).closed? end |
#flush ⇒ Object
24 25 26 |
# File 'lib/rspec-interactive/threaded_output.rb', line 24 def flush (@thread_map[Thread.current] || @default).flush end |
#print(str = "") ⇒ Object
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 |
#sync ⇒ Object
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 |