Merge pull request #332 from bovi/printf-not-implemented

Sprintf NotImplementedError
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-06-26 23:24:18 -07:00
+17 -5
View File
@@ -48,12 +48,24 @@ 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
##
# +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