2 # output-method.rb - optput methods used by irb
3 # $Release Version: 0.9.5$
5 # $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
6 # by Keiju ISHITSUKA(keiju@ruby-lang.org)
20 @RCS_ID='-$Id: output-method.rb 11708 2007-02-12 23:01:19Z shyouhei $-'
23 IRB.fail NotImplementError, "print"
27 print opts.join(" "), "\n"
31 def printf(format, *opts)
33 format, opts = parse_printf_format(format, opts)
35 print sprintf(format, *opts)
40 # <ºÇ¾®¥Õ¥£¡¼¥ë¥ÉÉý> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
41 # <ÀºÅÙ>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
42 # #<Ťµ½¤ÀµÊ¸»ú>(hh|h|l|ll|L|q|j|z|t)
43 # <ÊÑ´¹½¤ÀµÊ¸»ú>[diouxXeEfgGcsb%]
44 def parse_printf_format(format, opts)
45 return format, opts if $1.size % 2 == 1
56 puts(*objs.collect{|obj| obj.inspect})
59 def ppx(prefix, *objs)
60 puts(*objs.collect{|obj| prefix+obj.inspect})
65 class StdioOutputMethod<OutputMethod