Module: IO::Writable

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

Instance Method Summary collapse

Instance Method Details

#<<(string) ⇒ Object



24
25
26
27
# File 'opal/opal/corelib/io.rb', line 24

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


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

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

#puts(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'opal/opal/corelib/io.rb', line 34

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