summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2012-06-27 14:13:11 +0800
committerDaniel Bovensiepen <[email protected]>2012-06-27 14:13:11 +0800
commite841135cc11b8f935e8ab19cb6f1793883cda65c (patch)
treef37d2d0eeaded1f2aa0729846c66accde0e9850a
parentcf8b6ec8418ce3970a82b80d514a17b0ffa61b53 (diff)
downloadmruby-e841135cc11b8f935e8ab19cb6f1793883cda65c.tar.gz
mruby-e841135cc11b8f935e8ab19cb6f1793883cda65c.zip
raise NotImplementedError in case of sprintf is missing
-rw-r--r--mrblib/print.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/mrblib/print.rb b/mrblib/print.rb
index 7ec6d70ef..bf8e6d726 100644
--- a/mrblib/print.rb
+++ b/mrblib/print.rb
@@ -48,12 +48,14 @@ module Kernel
args[0]
end
- if Kernel.respond_to?(:sprintf)
- ##
- # Invoke method +sprintf+ and pass +*args+ to it.
- # Pass return value to *print* of STDOUT.
- def printf(*args)
+ ##
+ # Invoke method +sprintf+ and pass +*args+ to it.
+ # Pass return value to *print* of STDOUT.
+ def printf(*args)
+ if Kernel.respond_to?(:sprintf)
__printstr__(sprintf(*args))
+ else
+ raise NotImplementedError.new('sprintf not available')
end
end
end