Sha256: 3d36ff77dd02fa207152944ac7e0ab1a4c44abd1f93a90b05258d904152706ed
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
class IO SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 def tty? @tty end def closed? @closed end attr_accessor :write_proc def write(string) `self.write_proc(string)` string.size end attr_accessor :sync, :tty def flush # noop end module Writable def <<(string) write(string) self end def print(*args) write args.map { |arg| String(arg) }.join($,) nil end def puts(*args) newline = $/ if args.empty? write $/ else write args.map { |arg| String(arg).chomp }.concat([nil]).join(newline) end nil end end module Readable def readbyte getbyte end def readchar getc end def readline(sep = $/) raise NotImplementedError end def readpartial(integer, outbuf = nil) raise NotImplementedError end end end STDERR = $stderr = IO.new STDIN = $stdin = IO.new STDOUT = $stdout = IO.new `var console = Opal.global.console` STDOUT.write_proc = `typeof(process) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}` STDERR.write_proc = `typeof(process) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}` STDOUT.extend(IO::Writable) STDERR.extend(IO::Writable)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-0.11.0.rc1 | opal/corelib/io.rb |