Class: Dommy::ReadableStreamDefaultController
- Inherits:
-
Object
- Object
- Dommy::ReadableStreamDefaultController
- Includes:
- Bridge::Methods
- 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.
Methods included from Bridge::Methods
Constructor Details
#initialize(stream) ⇒ ReadableStreamDefaultController
Returns a new instance of ReadableStreamDefaultController.
139 140 141 |
# File 'lib/dommy/streams.rb', line 139 def initialize(stream) @stream = stream end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/dommy/streams.rb', line 157 def __js_call__(method, args) case method when "enqueue" enqueue(args[0]) when "close" close when "error" error(args[0]) end end |
#close ⇒ Object
147 148 149 |
# File 'lib/dommy/streams.rb', line 147 def close @stream.__internal_close__ end |
#enqueue(chunk) ⇒ Object
143 144 145 |
# File 'lib/dommy/streams.rb', line 143 def enqueue(chunk) @stream.__internal_enqueue__(chunk) end |
#error(reason) ⇒ Object
151 152 153 |
# File 'lib/dommy/streams.rb', line 151 def error(reason) @stream.__internal_error__(reason) end |