* lib/delegate.rb (Delegator#methods): Kernel#methods receives
zero or one argument. [ruby-core:37118] [Bug #4882] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e21f885bb0
commit
6e56d645f0
@ -1,3 +1,8 @@
|
|||||||
|
Sun Dec 4 12:03:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/delegate.rb (Delegator#methods): Kernel#methods receives
|
||||||
|
zero or one argument. [ruby-core:37118] [Bug #4882]
|
||||||
|
|
||||||
Sun Dec 4 10:15:00 2011 Luis Lavena <luislavena@gmail.com>
|
Sun Dec 4 10:15:00 2011 Luis Lavena <luislavena@gmail.com>
|
||||||
|
|
||||||
* ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default
|
* ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default
|
||||||
|
4
class.c
4
class.c
@ -1111,11 +1111,13 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* obj.methods -> array
|
* obj.methods(all=true) -> array
|
||||||
*
|
*
|
||||||
* Returns a list of the names of public and protected methods of
|
* Returns a list of the names of public and protected methods of
|
||||||
* <i>obj</i>. This will include all the methods accessible in
|
* <i>obj</i>. This will include all the methods accessible in
|
||||||
* <i>obj</i>'s ancestors.
|
* <i>obj</i>'s ancestors.
|
||||||
|
* If the <i>all</i> parameter is set to <code>false</code>, only those methods
|
||||||
|
* in the receiver will be listed.
|
||||||
*
|
*
|
||||||
* class Klass
|
* class Klass
|
||||||
* def klass_method()
|
* def klass_method()
|
||||||
|
@ -92,8 +92,8 @@ class Delegator < BasicObject
|
|||||||
# Returns the methods available to this delegate object as the union
|
# Returns the methods available to this delegate object as the union
|
||||||
# of this object's and \_\_getobj\_\_ methods.
|
# of this object's and \_\_getobj\_\_ methods.
|
||||||
#
|
#
|
||||||
def methods
|
def methods(all=true)
|
||||||
__getobj__.methods | super
|
__getobj__.methods(all) | super
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -111,6 +111,13 @@ class TestDelegateClass < Test::Unit::TestCase
|
|||||||
assert_raise(NoMethodError, '[ruby-dev:40314]#3') {m.call}
|
assert_raise(NoMethodError, '[ruby-dev:40314]#3') {m.call}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_methods
|
||||||
|
s = SimpleDelegator.new("foo")
|
||||||
|
assert_equal([], s.methods(false))
|
||||||
|
def s.bar; end
|
||||||
|
assert_equal([:bar], s.methods(false))
|
||||||
|
end
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
private
|
private
|
||||||
def delegate_test_private
|
def delegate_test_private
|
||||||
|
Loading…
x
Reference in New Issue
Block a user