define_method -> define_singleton_method

This commit is contained in:
Denis Knauf 2010-04-01 13:56:40 +02:00
parent ff2a4aa040
commit 8989f3c559

View file

@ -64,8 +64,8 @@ class LogAn::AutoValueConvertHash
@source, @encode = source, decode.nil? ? encode || Marshal.method( :dump) : encode,
@each, @decode = each, decode || Marshal.method( :restore)
@each ||= source.method( :each) rescue NameError
define_method :encode, &@encode if @encode
define_method :decode, &@decode if @decode
define_singleton_method :encode, &@encode if @encode
define_singleton_method :decode, &@decode if @decode
end
def [] k