summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-18 15:01:45 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-18 15:01:45 +0900
commit2728f302976573f13b6942cc426fb840f597cb61 (patch)
tree34bee7166d811c1a47da42146e672fb4d9e243cb /mrblib
parentf7406435f371c6607e80e58777e76efd08d32dd0 (diff)
downloadmruby-2728f302976573f13b6942cc426fb840f597cb61.tar.gz
mruby-2728f302976573f13b6942cc426fb840f597cb61.zip
implement Kernel#p in Ruby
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/print.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/mrblib/print.rb b/mrblib/print.rb
index 840a1249a..52beb26cb 100644
--- a/mrblib/print.rb
+++ b/mrblib/print.rb
@@ -31,4 +31,19 @@ module Kernel
end
__printstr__ "\n" if len == 0
end
+
+ ##
+ # Print human readable object description
+ #
+ # ISO 15.3.1.3.34
+ def p(*args)
+ i = 0
+ len = args.size
+ while i < len
+ __printstr__ args[i].inspect
+ __printstr__ "\n"
+ i += 1
+ end
+ args[0]
+ end
end