vendor/mruby-source/mrbgems/mruby-io/mrblib/kernel.rb
raw| 1 | module Kernel |
| 2 | def `(cmd) |
| 3 | IO.popen(cmd) { |io| io.read } |
| 4 | end |
| 5 | |
| 6 | def open(file, *rest, &block) |
| 7 | raise ArgumentError unless file.is_a?(String) |
| 8 | |
| 9 | if file[0] == "|" |
| 10 | IO.popen(file[1..-1], *rest, &block) |
| 11 | else |
| 12 | File.open(file, *rest, &block) |
| 13 | end |
| 14 | end |
| 15 | |
| 16 | def print(*args) |
| 17 | $stdout.print(*args) |
| 18 | end |
| 19 | |
| 20 | def puts(*args) |
| 21 | $stdout.puts(*args) |
| 22 | end |
| 23 | |
| 24 | def printf(*args) |
| 25 | $stdout.printf(*args) |
| 26 | end |
| 27 | |
| 28 | def gets(*args) |
| 29 | $stdin.gets(*args) |
| 30 | end |
| 31 | end |