mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (string_content): turn off NODE_NEWLINE flag to avoid
unnecessary line trace for inlined expression. (ruby-bugs PR#1320) * numeric.c (flo_to_s): tweak output string based to preserve decimal point and to remove trailing zeros. [ruby-talk:97891] * string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM search. [ruby-talk:97342] * hash.c (rb_hash_equal): returns true if two hashes have same set of key-value set. [ruby-talk:97559] * hash.c (rb_hash_eql): returns true if two hashes are equal and have same default values. * string.c (rb_str_equal): always returns true or false, never returns nil. [ruby-dev:23404] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c4216a26e2
commit
1b0f90ca33
22 changed files with 272 additions and 111 deletions
|
@ -87,20 +87,27 @@ def DelegateClass(superclass)
|
|||
methods = superclass.public_instance_methods(true)
|
||||
methods -= ::Kernel.public_instance_methods(false)
|
||||
methods |= ["to_s","to_a","inspect","==","=~","==="]
|
||||
klass.module_eval <<-EOS
|
||||
def initialize(obj)
|
||||
@_dc_obj = obj
|
||||
end
|
||||
def __getobj__
|
||||
@_dc_obj
|
||||
end
|
||||
def __setobj__(obj)
|
||||
@_dc_obj = obj
|
||||
end
|
||||
EOS
|
||||
klass.module_eval {
|
||||
def initialize(obj)
|
||||
@_dc_obj = obj
|
||||
end
|
||||
def method_missing(m, *args)
|
||||
p [m, *args]
|
||||
unless @_dc_obj.respond_to?(m)
|
||||
super(m, *args)
|
||||
end
|
||||
@_dc_obj.__send__(m, *args)
|
||||
end
|
||||
def __getobj__
|
||||
@_dc_obj
|
||||
end
|
||||
def __setobj__(obj)
|
||||
@_dc_obj = obj
|
||||
end
|
||||
}
|
||||
for method in methods
|
||||
begin
|
||||
klass.module_eval <<-EOS
|
||||
klass.module_eval <<-EOS, __FILE__, __LINE__+1
|
||||
def #{method}(*args, &block)
|
||||
begin
|
||||
@_dc_obj.__send__(:#{method}, *args, &block)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue