Module: IO::Writable

Defined in:
opal/opal/corelib/io.rb

Instance Method Summary collapse

Instance Method Details

#<<(string) ⇒ Object


28
29
30
31
# File 'opal/opal/corelib/io.rb', line 28

def <<(string)
  write(string)
  self
end

33
34
35
36
# File 'opal/opal/corelib/io.rb', line 33

def print(*args)
  write args.map { |arg| String(arg) }.join($,)
  nil
end

#puts(*args) ⇒ Object


38
39
40
41
42
43
44
45
46
# File 'opal/opal/corelib/io.rb', line 38

def puts(*args)
  newline = $/
  if args.empty?
    write $/
  else
    write args.map { |arg| String(arg).chomp }.concat([nil]).join(newline)
  end
  nil
end