Class: Dommy::ReadableStreamDefaultReader
- Inherits:
-
Object
- Object
- Dommy::ReadableStreamDefaultReader
- Includes:
- Bridge::Methods
- Defined in:
- lib/dommy/streams.rb
Overview
Reader returned by ‘getReader()`.
Instance Method Summary collapse
- #__js_call__(method, args) ⇒ Object
- #cancel(reason = nil) ⇒ Object
-
#initialize(stream) ⇒ ReadableStreamDefaultReader
constructor
A new instance of ReadableStreamDefaultReader.
- #read ⇒ Object
- #release_lock ⇒ Object (also: #releaseLock)
Methods included from Bridge::Methods
Constructor Details
#initialize(stream) ⇒ ReadableStreamDefaultReader
Returns a new instance of ReadableStreamDefaultReader.
169 170 171 |
# File 'lib/dommy/streams.rb', line 169 def initialize(stream) @stream = stream end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/dommy/streams.rb', line 191 def __js_call__(method, args) case method when "read" read when "releaseLock" release_lock when "cancel" cancel(args[0]) end end |
#cancel(reason = nil) ⇒ Object
185 186 187 |
# File 'lib/dommy/streams.rb', line 185 def cancel(reason = nil) @stream.cancel(reason) end |
#read ⇒ Object
173 174 175 |
# File 'lib/dommy/streams.rb', line 173 def read @stream.__internal_read__ end |
#release_lock ⇒ Object Also known as: releaseLock
177 178 179 180 181 |
# File 'lib/dommy/streams.rb', line 177 def release_lock # Spec: detaches the reader. We model the stream's `@reader` # slot indirectly via `releaseLock` accessibility. nil end |