| 1 |
## |
| 2 |
# Kernel |
| 3 |
# |
| 4 |
# ISO 15.3.1 |
| 5 |
module Kernel |
| 6 |
## |
| 7 |
# Print human readable object description |
| 8 |
# |
| 9 |
# ISO 15.3.1.2.9 Kernel.p |
| 10 |
# ISO 15.3.1.3.34 Kernel#p |
| 11 |
def p(*args) |
| 12 |
i = 0 |
| 13 |
len = args.size |
| 14 |
while i < len |
| 15 |
print args[i].inspect, "\n" |
| 16 |
i += 1 |
| 17 |
end |
| 18 |
args.__svalue |
| 19 |
end |
| 20 |
|
| 21 |
# ISO 15.3.1.2.11 Kernel.puts |
| 22 |
# ISO 15.3.1.3.39 Kernel#puts |
| 23 |
def puts(*args) |
| 24 |
i = 0 |
| 25 |
len = args.size |
| 26 |
while i < len |
| 27 |
s = args[i] |
| 28 |
if s.kind_of?(Array) |
| 29 |
puts(*s) |
| 30 |
else |
| 31 |
s = s.to_s |
| 32 |
print s |
| 33 |
print "\n" if (s[-1] != "\n") |
| 34 |
end |
| 35 |
i += 1 |
| 36 |
end |
| 37 |
print "\n" if len == 0 |
| 38 |
end |
| 39 |
|
| 40 |
def printf(*args) |
| 41 |
print(sprintf(*args)) |
| 42 |
end |
| 43 |
end |