Class: Dommy::WritableStreamDefaultWriter

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

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ WritableStreamDefaultWriter

Returns a new instance of WritableStreamDefaultWriter.



282
283
284
# File 'lib/dommy/streams.rb', line 282

def initialize(stream)
  @stream = stream
end

Instance Method Details

#__js_call__(method, args) ⇒ Object



298
299
300
301
302
303
304
305
306
307
# File 'lib/dommy/streams.rb', line 298

def __js_call__(method, args)
  case method
  when "write"
    write(args[0])
  when "close"
    close
  when "abort"
    abort(args[0])
  end
end

#abort(reason = nil) ⇒ Object



294
295
296
# File 'lib/dommy/streams.rb', line 294

def abort(reason = nil)
  @stream.__abort__(reason)
end

#closeObject



290
291
292
# File 'lib/dommy/streams.rb', line 290

def close
  @stream.__close__
end

#write(chunk) ⇒ Object



286
287
288
# File 'lib/dommy/streams.rb', line 286

def write(chunk)
  @stream.__write__(chunk)
end