diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-06-21 15:44:27 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-06-21 15:44:27 +0800 |
| commit | 2436ee817adfca3de7b758fa83f959d4079f134f (patch) | |
| tree | 1734c4584f8671472048e52bacb605f260dc2ab1 | |
| parent | d105ea496f686b6ef3071e127864fab4677befac (diff) | |
| download | mruby-2436ee817adfca3de7b758fa83f959d4079f134f.tar.gz mruby-2436ee817adfca3de7b758fa83f959d4079f134f.zip | |
Make printf optional based on sprintf
| -rw-r--r-- | mrblib/print.rb | 9 |
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 |
