diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-27 09:16:20 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-27 09:16:20 +0000 |
| commit | e21f706bbd8c4fec757fbb65835b0e00e683400d (patch) | |
| tree | 49ef99e2eb178bd48e8ca50db077267c13f1b3c5 /lib | |
| parent | b154c9488ec0e660ac4ebe7e14bede39f064d731 (diff) | |
| download | ruby-e21f706bbd8c4fec757fbb65835b0e00e683400d.tar.gz ruby-e21f706bbd8c4fec757fbb65835b0e00e683400d.tar.xz ruby-e21f706bbd8c4fec757fbb65835b0e00e683400d.zip | |
* gc.c (gc_sweep): recover ruby_in_compile variable.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ostruct.rb | 8 | ||||
| -rw-r--r-- | lib/pstore.rb | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb index d603c0475..d92ee503a 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -52,6 +52,13 @@ class OpenStruct end end + def new_ostruct_member(name) + self.instance_eval %{ + def #{name}; @table[:#{name}]; end + def #{name}=(x); @table[:#{name}] = x; end + } + end + def method_missing(mid, *args) # :nodoc: mname = mid.id2name len = args.length @@ -64,6 +71,7 @@ class OpenStruct end mname.chop! @table[mname.intern] = args[0] + self.new_ostruct_member(mname) elsif len == 0 @table[mid] else diff --git a/lib/pstore.rb b/lib/pstore.rb index 50313dcb8..51cef6e13 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -104,10 +104,14 @@ class PStore commit_new(file) if FileTest.exist?(new_file) content = file.read() else - file = File.open(@filename, File::RDONLY) - file.binmode - file.flock(File::LOCK_SH) - content = (File.read(new_file) rescue file.read()) + begin + file = File.open(@filename, File::RDONLY) + file.binmode + file.flock(File::LOCK_SH) + content = (File.read(new_file) rescue file.read()) + rescue Errno::ENOENT + content = "" + end end if content != "" |
