Last change
on this file was 439, checked in by coas-nagasima, 4 years ago |
mrubyを2.1.1に更新
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-ruby;charset=UTF-8
|
File size:
873 bytes
|
Rev | Line | |
---|
[270] | 1 | ##
|
---|
| 2 | # Kernel
|
---|
| 3 | #
|
---|
| 4 | # ISO 15.3.1
|
---|
| 5 | module Kernel
|
---|
| 6 | ##
|
---|
| 7 | # Invoke method +print+ on STDOUT and passing +*args+
|
---|
| 8 | #
|
---|
| 9 | # ISO 15.3.1.2.10
|
---|
| 10 | def print(*args)
|
---|
| 11 | i = 0
|
---|
| 12 | len = args.size
|
---|
| 13 | while i < len
|
---|
| 14 | __printstr__ args[i].to_s
|
---|
| 15 | i += 1
|
---|
| 16 | end
|
---|
| 17 | end
|
---|
| 18 |
|
---|
| 19 | ##
|
---|
| 20 | # Invoke method +puts+ on STDOUT and passing +*args*+
|
---|
| 21 | #
|
---|
| 22 | # ISO 15.3.1.2.11
|
---|
| 23 | def puts(*args)
|
---|
| 24 | i = 0
|
---|
| 25 | len = args.size
|
---|
| 26 | while i < len
|
---|
| 27 | s = args[i].to_s
|
---|
| 28 | __printstr__ s
|
---|
| 29 | __printstr__ "\n" if (s[-1] != "\n")
|
---|
| 30 | i += 1
|
---|
| 31 | end
|
---|
| 32 | __printstr__ "\n" if len == 0
|
---|
| 33 | nil
|
---|
| 34 | end
|
---|
| 35 |
|
---|
| 36 | ##
|
---|
| 37 | # Print human readable object description
|
---|
| 38 | #
|
---|
| 39 | # ISO 15.3.1.3.34
|
---|
| 40 | def p(*args)
|
---|
| 41 | i = 0
|
---|
| 42 | len = args.size
|
---|
| 43 | while i < len
|
---|
| 44 | __printstr__ args[i].inspect
|
---|
| 45 | __printstr__ "\n"
|
---|
| 46 | i += 1
|
---|
| 47 | end
|
---|
[439] | 48 | args.__svalue
|
---|
[270] | 49 | end
|
---|
| 50 |
|
---|
[439] | 51 | def printf(*args)
|
---|
| 52 | __printstr__(sprintf(*args))
|
---|
| 53 | nil
|
---|
[270] | 54 | end
|
---|
| 55 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.