diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-21 02:55:28 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-21 02:55:28 -0700 |
| commit | 8dcf0bc259d64afc10ad9fa717e43a901b1f15b5 (patch) | |
| tree | 1a9c987919a52b5a86eb8f68d44ff826894b2a61 | |
| parent | 766ae4ee5f99ea96dac166a3dfa0791baa77f353 (diff) | |
| parent | 2436ee817adfca3de7b758fa83f959d4079f134f (diff) | |
| download | mruby-8dcf0bc259d64afc10ad9fa717e43a901b1f15b5.tar.gz mruby-8dcf0bc259d64afc10ad9fa717e43a901b1f15b5.zip | |
Merge pull request #306 from bovi/printf-optional
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 |
