mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.
[ruby-talk:117841] * ruby.h (FL_ABLE): nodes are not subject for flag operations. * io.c (ARGF_FORWARD): should have specified argv explicitly, since we no longer have frame->argv saved. [ruby-dev:24602] * string.c (RESIZE_CAPA): check string attribute before modifying capacity member of string structure. [ruby-dev:24594] * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in interpreter termination. [ruby-dev:24579] * eval.c (frame_free): Guy Decoux solved the leak problem. Thanks. [ruby-core:03549] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6ffdbac5ed
commit
018837b84f
18 changed files with 149 additions and 80 deletions
|
@ -58,6 +58,13 @@ class OpenStruct
|
|||
@table = @table.dup
|
||||
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
|
||||
|
@ -70,6 +77,7 @@ class OpenStruct
|
|||
end
|
||||
mname.chop!
|
||||
@table[mname.intern] = args[0]
|
||||
self.new_ostruct_member(mname)
|
||||
elsif len == 0
|
||||
@table[mid]
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue