* eval.c (proc_invoke): copy arguments to frame.argv.

[ruby-core:03861]

* object.c (convert_type): use rb_respond_to() again.
  [ruby-dev:25021]

* eval.c (rb_respond_to): funcall respond_to? if it's redefined.
  [ruby-dev:25021]

* io.c (rb_file_initialize): [ruby-dev:25032]

* lib/ostruct.rb (OpenStruct::Marshaler): OpenStruct can be
  marshaled again.  [ruby-core:03862]

* io.c (rb_io_ctl): [ruby-dev:25019]

* io.c (io_fread): need not to null terminate.  [ruby-dev:24998]

* io.c (read_all): remove unnecessary rb_str_resize().
  [ruby-dev:24996]

* io.c (io_read): ditto.

* io.c (rb_io_sysread): use temporary lock.  [ruby-dev:24992]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-12-03 09:30:33 +00:00
parent 744ec6294c
commit 379e85a5f5
5 changed files with 107 additions and 16 deletions

View file

@ -48,15 +48,36 @@ class OpenStruct
if hash
for k,v in hash
@table[k.to_sym] = v
new_ostruct_member(k)
end
end
end
# Duplicate an OpenStruct object members.
def initialize_copy(orig)
super
@table = @table.dup
end
module Marshaler
def marshal_dump
table = @table
OpenStruct.new.instance_eval{@table=table; self}
end
def marshal_load(x)
@table = x.instance_variable_get("@table")
@table.each_key{|key| new_ostruct_member(key)}
end
end
def new_ostruct_member(name)
self.instance_eval %{
def #{name}; @table[:#{name}]; end
def #{name}=(x); @table[:#{name}] = x; end
}
unless self.respond_to?(name)
self.instance_eval %{
extend OpenStruct::Marshaler
def #{name}; @table[:#{name}]; end
def #{name}=(x); @table[:#{name}] = x; end
}
end
end
def method_missing(mid, *args) # :nodoc: