From c0e98a13849403f3fbdb7e10b8f88d7e4e20552c Mon Sep 17 00:00:00 2001 From: nahi Date: Thu, 14 Nov 2002 22:46:00 +0000 Subject: [PATCH] * observer.rb: raise NoMethodError instead of NameError. [ruby-dev:18788] * ostruct.rb: ditto. fix a bug in inspect which called String#+ with Symbol. [ruby-dev:18788] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/observer.rb | 2 +- lib/ostruct.rb | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ea06908cb..a8323bffaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Nov 15 07:40:08 2002 NAKAMURA Hiroshi + + * observer.rb: raise NoMethodError instead of NameError. + [ruby-dev:18788] + + * ostruct.rb: ditto. fix a bug in inspect which called String#+ with + Symbol. [ruby-dev:18788] + Thu Nov 14 22:40:29 2002 Nobuyoshi Nakada * configure.in (LIBRUBY_A): append -static. [ruby-dev:18689] diff --git a/lib/observer.rb b/lib/observer.rb index e1b249e885..161297e70c 100644 --- a/lib/observer.rb +++ b/lib/observer.rb @@ -6,7 +6,7 @@ module Observable def add_observer(observer) @observer_peers = [] unless defined? @observer_peers unless observer.respond_to? :update - raise NameError, "observer needs to respond to `update'" + raise NoMethodError, "observer needs to respond to `update'" end @observer_peers.push observer end diff --git a/lib/ostruct.rb b/lib/ostruct.rb index a5c51022d4..d806c70466 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -30,7 +30,7 @@ class OpenStruct elsif args.length == 0 @table[mid] else - raise NameError, "undefined method `#{mname}'", caller(1) + raise NoMethodError, "undefined method `#{mname}'", caller(1) end end @@ -42,7 +42,7 @@ class OpenStruct str = "<#{self.class}" for k,v in @table str += " " - str += k + str += k.to_s str += "=" str += v.inspect end