Class: Dommy::TransformStreamDefaultController

Inherits:
Object
  • Object
show all
Includes:
Bridge::Methods
Defined in:
lib/dommy/streams.rb

Instance Method Summary collapse

Methods included from Bridge::Methods

included

Constructor Details

#initialize(readable) ⇒ TransformStreamDefaultController

Returns a new instance of TransformStreamDefaultController.



354
355
356
# File 'lib/dommy/streams.rb', line 354

def initialize(readable)
  @readable = readable
end

Instance Method Details

#__js_call__(method, args) ⇒ Object



372
373
374
375
376
377
378
379
380
381
# File 'lib/dommy/streams.rb', line 372

def __js_call__(method, args)
  case method
  when "enqueue"
    enqueue(args[0])
  when "terminate"
    terminate
  when "error"
    error(args[0])
  end
end

#enqueue(chunk) ⇒ Object



358
359
360
# File 'lib/dommy/streams.rb', line 358

def enqueue(chunk)
  @readable.__internal_enqueue__(chunk)
end

#error(reason) ⇒ Object



366
367
368
# File 'lib/dommy/streams.rb', line 366

def error(reason)
  @readable.__internal_error__(reason)
end

#terminateObject



362
363
364
# File 'lib/dommy/streams.rb', line 362

def terminate
  @readable.__internal_close__
end