source: EcnlProtoTool/trunk/mrbgems/mruby-io/mrblib/kernel.rb@ 279

Last change on this file since 279 was 279, checked in by coas-nagasima, 7 years ago

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby
File size: 281 bytes
Line 
1module 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
15end
Note: See TracBrowser for help on using the repository browser.