summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl/types.rb
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-25 08:39:31 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-25 08:39:31 +0000
commitf7884c6beb479950cb8863a556df38ec29806b9f (patch)
tree16884e428d2573913c0576819ad40960d29d5300 /ext/dl/lib/dl/types.rb
parentf7a5ee56d72e4badc825d60af0d8efc36d3d95d1 (diff)
bugfix for [ruby-talk:121309].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl/types.rb')
-rw-r--r--ext/dl/lib/dl/types.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/ext/dl/lib/dl/types.rb b/ext/dl/lib/dl/types.rb
index a929df6ccd..cc73893049 100644
--- a/ext/dl/lib/dl/types.rb
+++ b/ext/dl/lib/dl/types.rb
@@ -179,17 +179,12 @@ module DL
dec = nil
senc = nil
sdec = nil
- ty1 = nil
- ty2 = nil
+ ty1 = ty
+ ty2 = ty
@TYDEFS.each{|t1,t2,c1,c2,t3,c3,c4|
-# if( t1.is_a?(String) )
-# t1 = Regexp.new("^" + t1 + "$")
-# end
- if( (t1.is_a?(Regexp) && (t1 =~ ty)) || (t1 == ty) )
- ty1 = ty.gsub(t1,t2) if t2
- ty2 = ty.gsub(t1,t3) if t3
+ if( (t1.is_a?(Regexp) && (t1 =~ ty1)) || (t1 == ty1) )
+ ty1 = ty1.gsub(t1,t2) if t2
ty1.strip! if ty1
- ty2.strip! if ty2
if( enc )
if( c1 )
conv1 = enc
@@ -210,6 +205,10 @@ module DL
dec = c2
end
end
+ end
+ if( (t1.is_a?(Regexp) && (t1 =~ ty2)) || (t1 == ty2) )
+ ty2 = ty2.gsub(t1,t3) if t3
+ ty2.strip! if ty2
if( senc )
if( c3 )
conv3 = senc
@@ -230,11 +229,8 @@ module DL
sdec = c4
end
end
- end
+ end
}
- if( ty1.length != 1 && ty2.length != 1 )
- raise(TypeError, "unknown type: #{orig_ty}.")
- end
return [ty1,enc,dec,ty2,senc,sdec]
end
end # end of Types