| Class | IRB::OutputMethod |
| In: |
lib/irb/output-method.rb
|
| Parent: | Object |
StdioOutputMethod
# File lib/irb/output-method.rb, line 48
48: def foo(format)
49: pos = 0
50: inspects = []
51: format.scan(/%[#0\-+ ]?(\*(?=[^0-9])|\*[1-9][0-9]*\$|[1-9][0-9]*(?=[^0-9]))?(\.(\*(?=[^0-9])|\*[1-9][0-9]*\$|[1-9][0-9]*(?=[^0-9])))?(([1-9][0-9]*\$)*)([diouxXeEfgGcsb%])/) {|f, p, pp, pos, new_pos, c|
52: puts [f, p, pp, pos, new_pos, c].join("!")
53: pos = new_pos if new_pos
54: if c == "I"
55: inspects.push pos.to_i
56: (f||"")+(p||"")+(pp||"")+(pos||"")+"s"
57: else
58: $&
59: end
60: }
61: end
% <フラグ> [0- +] <最小フィールド幅> (*|*[1-9][0-9]*\$|[1-9][0-9]*) <精度>.(*|*[1-9][0-9]*\$|[1-9][0-9]*|)? #<長さ修正文字>(hh|h|l|ll|L|q|j|z|t) <変換修正文字>[diouxXeEfgGcsb%]
# File lib/irb/output-method.rb, line 44
44: def parse_printf_format(format, opts)
45: return format, opts if $1.size % 2 == 1
46: end
# File lib/irb/output-method.rb, line 70
70: def pp(*objs)
71: puts(*objs.collect{|obj| obj.inspect})
72: end
# File lib/irb/output-method.rb, line 74
74: def ppx(prefix, *objs)
75: puts(*objs.collect{|obj| prefix+obj.inspect})
76: end
# File lib/irb/output-method.rb, line 22
22: def print(*opts)
23: IRB.fail NotImplementError, "print"
24: end
# File lib/irb/output-method.rb, line 26
26: def printn(*opts)
27: print opts.join(" "), "\n"
28: end