mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
941b99955a
`Kernel#getc` has been removed since Ruby 1.9 and is not defined in ISO.
32 lines
482 B
Ruby
32 lines
482 B
Ruby
module Kernel
|
|
def `(cmd)
|
|
IO.popen(cmd) { |io| io.read }
|
|
end
|
|
|
|
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
|
|
|
|
def print(*args)
|
|
$stdout.print(*args)
|
|
end
|
|
|
|
def puts(*args)
|
|
$stdout.puts(*args)
|
|
end
|
|
|
|
def printf(*args)
|
|
$stdout.printf(*args)
|
|
end
|
|
|
|
def gets(*args)
|
|
$stdin.gets(*args)
|
|
end
|
|
end
|