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.
137 138 139 |
# File 'lib/dommy/streams.rb', line 137 def initialize(stream) @stream = stream end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/dommy/streams.rb', line 155 def __js_call__(method, args) case method when "enqueue" enqueue(args[0]) when "close" close when "error" error(args[0]) end end |
#close ⇒ Object
145 146 147 |
# File 'lib/dommy/streams.rb', line 145 def close @stream.__internal_close__ end |
#enqueue(chunk) ⇒ Object
141 142 143 |
# File 'lib/dommy/streams.rb', line 141 def enqueue(chunk) @stream.__internal_enqueue__(chunk) end |
#error(reason) ⇒ Object
149 150 151 |
# File 'lib/dommy/streams.rb', line 149 def error(reason) @stream.__internal_error__(reason) end |