aboutsummaryrefslogtreecommitdiffstats
path: root/lib/e2mmap.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-15 06:03:22 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-15 06:03:22 +0000
commitc5851d1d6906e130bbb156d9ace962c59c8b0086 (patch)
tree44fd063b0557b3cfca6ff2d9a85482ed7f388e35 /lib/e2mmap.rb
parentf2b0dba1cfff30d94d21d224a2c240752fda8edb (diff)
downloadruby-c5851d1d6906e130bbb156d9ace962c59c8b0086.tar.gz
* lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no
longer modifiable in 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/e2mmap.rb')
-rw-r--r--lib/e2mmap.rb29
1 files changed, 4 insertions, 25 deletions
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index 00d4f83eb8..7d935b4c1f 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -55,15 +55,9 @@ module Exception2MessageMapper
def E2MM.extend_object(cl)
super
- cl.bind(self) unless cl == E2MM
+ cl.bind(self) unless cl < E2MM
end
- # backward compatibility
- def E2MM.extend_to(b)
- c = eval("self", b)
- c.extend(self)
- end
-
def bind(cl)
self.module_eval %[
def Raise(err = nil, *rest)
@@ -86,20 +80,6 @@ module Exception2MessageMapper
end
alias Fail Raise
- # backward compatibility
- alias fail! fail
- def fail(err = nil, *rest)
- begin
- E2MM.Fail(self, err, *rest)
- rescue E2MM::ErrNotRegisteredException
- super
- end
- end
- class << self
- public :fail
- end
-
-
# def_e2message(c, m)
# c: exception
# m: message_form
@@ -157,12 +137,11 @@ module Exception2MessageMapper
#
def E2MM.Raise(klass = E2MM, err = nil, *rest)
if form = e2mm_message(klass, err)
- $! = err.new(sprintf(form, *rest))
- $@ = caller(1) if $@.nil?
+ b = $@.nil? ? caller(1) : $@
#p $@
#p __FILE__
- $@.shift if $@[0] =~ /^#{Regexp.quote(__FILE__)}:/
- raise
+ b.shift if b[0] =~ /^#{Regexp.quote(__FILE__)}:/
+ raise err, sprintf(form, *rest), b
else
E2MM.Fail E2MM, ErrNotRegisteredException, err.inspect
end