File: kernel.rb

package info (click to toggle)
mruby 3.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,584 kB
  • sloc: ansic: 51,933; ruby: 29,510; yacc: 7,077; cpp: 517; makefile: 51; sh: 42
file content (39 lines) | stat: -rw-r--r-- 639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Kernel
  private def `(cmd) #`
    IO.popen(cmd) { |io| io.read }
  end

  private def open(file, *rest, &block)
    raise ArgumentError unless file.is_a?(String)

    if file[0] == "|"
      IO.popen(file[1..-1], *rest, &block)
    else
      File.open(file, *rest, &block)
    end
  end

  private def print(...)
    $stdout.print(...)
  end

  private def puts(...)
    $stdout.puts(...)
  end

  private def printf(...)
    $stdout.printf(...)
  end

  private def gets(...)
    $stdin.gets(...)
  end

  private def readline(...)
    $stdin.readline(...)
  end

  private def readlines(...)
    $stdin.readlines(...)
  end
end