diff options
| author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-05 05:28:11 +0000 |
|---|---|---|
| committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-05 05:28:11 +0000 |
| commit | e1e2c76f585c40766fd39c20b72707b11c8d4f6c (patch) | |
| tree | 199a86ddb13acf390231e4664a98e060a5c43f89 | |
| parent | 6f3784254144eefd1f464440c095e937a590d9c0 (diff) | |
| download | ruby-e1e2c76f585c40766fd39c20b72707b11c8d4f6c.tar.gz ruby-e1e2c76f585c40766fd39c20b72707b11c8d4f6c.tar.xz ruby-e1e2c76f585c40766fd39c20b72707b11c8d4f6c.zip | |
* lib/pstore.rb: should return default value if name is not found.
[ruby-core:7304]
* lib/pstore.rb: should raise PStore::Error if not in transaction.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rw-r--r-- | lib/pstore.rb | 5 |
2 files changed, 10 insertions, 5 deletions
@@ -1,3 +1,10 @@ +Sun Feb 5 14:22:15 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> + + * lib/pstore.rb: should return default value if name is not found. + [ruby-core:7304] + + * lib/pstore.rb: should raise PStore::Error if not in transaction. + Sat Feb 4 22:51:43 2006 Tanaka Akira <akr@m17n.org> * eval.c: apply the FreeBSD getcontext/setcontext workaround @@ -13,9 +20,6 @@ Sat Feb 4 15:56:37 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> * numeric.c (fix_to_s): (2**32).to_s(2) fails with exception where sizeof(int) == 4 < sizeof(long). [ruby-core:7300] - I think the function name of rb_int2big is quite misleading. - This should be "rb_long2big". - Fri Feb 3 15:06:50 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> * ext/syck/syck.c (syck_move_tokens): should reset p->cursor or etc diff --git a/lib/pstore.rb b/lib/pstore.rb index a691ce611..46123bf0a 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -135,14 +135,15 @@ class PStore # raise PStore::Error if called at any other time. # def fetch(name, default=PStore::Error) + in_transaction unless @table.key? name if default==PStore::Error raise PStore::Error, format("undefined root name `%s'", name) else - default + return default end end - self[name] + @table[name] end # # Stores an individual Ruby object or a hierarchy of Ruby objects in the data |
