summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2012-06-27 14:20:19 +0800
committerDaniel Bovensiepen <[email protected]>2012-06-27 14:20:19 +0800
commit7f9b91517bdad2848659fd4bcaee71545e0562ea (patch)
treeeb42e58ba489e4fdb81dd551419746ebe92280e2
parente841135cc11b8f935e8ab19cb6f1793883cda65c (diff)
downloadmruby-7f9b91517bdad2848659fd4bcaee71545e0562ea.tar.gz
mruby-7f9b91517bdad2848659fd4bcaee71545e0562ea.zip
raise NoImplementedError also for sprintf in case it isn't available
-rw-r--r--mrblib/print.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/mrblib/print.rb b/mrblib/print.rb
index bf8e6d726..3ebd77ee6 100644
--- a/mrblib/print.rb
+++ b/mrblib/print.rb
@@ -50,7 +50,7 @@ module Kernel
##
# Invoke method +sprintf+ and pass +*args+ to it.
- # Pass return value to *print* of STDOUT.
+ # Pass return value to +print+ of STDOUT.
def printf(*args)
if Kernel.respond_to?(:sprintf)
__printstr__(sprintf(*args))
@@ -58,4 +58,14 @@ module Kernel
raise NotImplementedError.new('sprintf not available')
end
end
+
+ ##
+ # +sprintf+ is defined in +src/sprintf.c+
+ # This stub method is only to inform the user
+ # that +sprintf+ isn't implemented.
+ unless Kernel.respond_to?(:sprintf)
+ def sprintf(*args)
+ raise NotImplementedError.new('sprintf not available')
+ end
+ end
end