summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2012-06-21 15:44:27 +0800
committerDaniel Bovensiepen <[email protected]>2012-06-21 15:44:27 +0800
commit2436ee817adfca3de7b758fa83f959d4079f134f (patch)
tree1734c4584f8671472048e52bacb605f260dc2ab1
parentd105ea496f686b6ef3071e127864fab4677befac (diff)
downloadmruby-2436ee817adfca3de7b758fa83f959d4079f134f.tar.gz
mruby-2436ee817adfca3de7b758fa83f959d4079f134f.zip
Make printf optional based on sprintf
-rw-r--r--mrblib/print.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/mrblib/print.rb b/mrblib/print.rb
index 452ba53a9..7ec6d70ef 100644
--- a/mrblib/print.rb
+++ b/mrblib/print.rb
@@ -48,7 +48,12 @@ module Kernel
args[0]
end
- def printf(*args)
- __printstr__(sprintf(*args))
+ if Kernel.respond_to?(:sprintf)
+ ##
+ # Invoke method +sprintf+ and pass +*args+ to it.
+ # Pass return value to *print* of STDOUT.
+ def printf(*args)
+ __printstr__(sprintf(*args))
+ end
end
end