diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-03 04:56:25 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-03 04:56:25 +0000 |
| commit | 741f44a042ce5ab7e060296e2476d3dc33090a80 (patch) | |
| tree | df3be019a29fca68dc14bd106d074d8f18c21875 /lib/ostruct.rb | |
| parent | a9278637aac2aaaaa1eb57e594402f36e3382bbb (diff) | |
| download | ruby-741f44a042ce5ab7e060296e2476d3dc33090a80.tar.gz ruby-741f44a042ce5ab7e060296e2476d3dc33090a80.tar.xz ruby-741f44a042ce5ab7e060296e2476d3dc33090a80.zip | |
* eval.c (proc_invoke): prepare to pass a block from "call" method
to a Proc generated by Method#to_proc. [ruby-dev:25031]
* eval.c (rb_yield_0): actually passes a block given to "call".
* object.c (convert_type): use rb_respond_to() again. this fix is
based on [ruby-dev:25021]
* eval.c (rb_respond_to): funcall respond_to? if it's redefined.
[ruby-dev:25021]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ostruct.rb')
| -rw-r--r-- | lib/ostruct.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 7f4668283..b30ae640c 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -59,21 +59,17 @@ class OpenStruct @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 + def marshal_dump + @table + end + def marshal_load(x) + @table = x + @table.each_key{|key| new_ostruct_member(key)} end def new_ostruct_member(name) unless self.respond_to?(name) self.instance_eval %{ - extend OpenStruct::Marshaler def #{name}; @table[:#{name}]; end def #{name}=(x); @table[:#{name}] = x; end } |
