Class: Dommy::ReadableStreamDefaultController
- Inherits:
-
Object
- Object
- Dommy::ReadableStreamDefaultController
- Defined in:
- lib/dommy/streams.rb
Overview
Controller passed to ReadableStream’s ‘start` / `pull` callbacks.
Instance Method Summary collapse
- #__js_call__(method, args) ⇒ Object
- #close ⇒ Object
- #enqueue(chunk) ⇒ Object
- #error(reason) ⇒ Object
-
#initialize(stream) ⇒ ReadableStreamDefaultController
constructor
A new instance of ReadableStreamDefaultController.
Constructor Details
#initialize(stream) ⇒ ReadableStreamDefaultController
Returns a new instance of ReadableStreamDefaultController.
145 146 147 |
# File 'lib/dommy/streams.rb', line 145 def initialize(stream) @stream = stream end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/dommy/streams.rb', line 161 def __js_call__(method, args) case method when "enqueue" enqueue(args[0]) when "close" close when "error" error(args[0]) end end |
#close ⇒ Object
153 154 155 |
# File 'lib/dommy/streams.rb', line 153 def close @stream.__close__ end |
#enqueue(chunk) ⇒ Object
149 150 151 |
# File 'lib/dommy/streams.rb', line 149 def enqueue(chunk) @stream.__enqueue__(chunk) end |
#error(reason) ⇒ Object
157 158 159 |
# File 'lib/dommy/streams.rb', line 157 def error(reason) @stream.__error__(reason) end |