Class: IO

Inherits:
Object
  • Object
show all
Defined in:
lib/io/stream/shim/readable.rb,
lib/io/stream.rb,
lib/io/stream/shim/timeout.rb,
lib/io/stream/shim/buffered.rb

Overview

Released under the MIT License. Copyright, 2023-2024, by Samuel Williams.

Defined Under Namespace

Modules: Stream Classes: TimeoutError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timeoutObject

Compatibility shim.



12
13
14
# File 'lib/io/stream/shim/timeout.rb', line 12

def timeout
  @timeout
end

Class Method Details

.Stream(io) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/io/stream.rb', line 13

def self.Stream(io)
	if io.is_a?(Stream::Buffered)
		io
	else
		Stream::Buffered.wrap(io)
	end
end

Instance Method Details

#buffered=(value) ⇒ Object



12
13
14
# File 'lib/io/stream/shim/buffered.rb', line 12

def buffered=(value)
	self.sync = !value
end

#buffered?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/io/stream/shim/buffered.rb', line 8

def buffered?
	return !self.sync
end

#readable?Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/io/stream/shim/readable.rb', line 8

def readable?
	# Do not call `eof?` here as it is not concurrency-safe and it can block.
	!closed?
end