Skip to content
Permalink
Browse files

Merge pull request #766 from kachick/module-visibility_setters_returned

Module#{public,protected,private} should return self
  • Loading branch information
alex committed Jun 24, 2013
2 parents 6bfad55 + 2b4b408 commit 845a21bb84697267f80e46c99388a9a42777b292
@@ -1,7 +1,4 @@
fails:Module#private_class_method makes an existing class method private
fails:Module#private_class_method makes an existing class method private up the inheritance tree
fails:Module#private_class_method accepts more than one method at a time
fails:Module#private_class_method raises a NameError if class method doesn't exist
fails:Module#private_class_method raises a NameError when the given name is not a method
fails:Module#private_class_method raises a NameError when the given name is an instance method
fails:Module#private_class_method makes a class method private
@@ -1,4 +1,3 @@
fails:Module#private makes the target method uncallable from other types
fails:Module#private makes a public Object instance method private in a new module
fails:Module#private makes a public Object instance method private in Kernel
fails:Module#private returns self
@@ -1,4 +1,3 @@
fails:Module#protected makes an existing class method protected
fails:Module#protected makes a public Object instance method protected in a new module
fails:Module#protected makes a public Object instance method protected in Kernel
fails:Module#protected returns self
@@ -1,6 +1,3 @@
fails:Module#public_class_method makes an existing class method public
fails:Module#public_class_method makes an existing class method public up the inheritance tree
fails:Module#public_class_method accepts more than one method at a time
fails:Module#public_class_method raises a NameError if class method doesn't exist
fails:Module#public_class_method raises a NameError when the given name is not a method
fails:Module#public_class_method raises a NameError when the given name is an instance method
@@ -1,3 +1,2 @@
fails:Module#public makes a private Object instance method public in a new module
fails:Module#public makes a private Object instance method public in Kernel
fails:Module#public returns self
@@ -526,14 +526,17 @@ def method_name(self, space):
@classdef.method("private")
def method_private(self, space, args_w):
self.set_visibility(space, args_w, W_FunctionObject.PRIVATE)
return self

@classdef.method("public")
def method_public(self, space, args_w):
self.set_visibility(space, args_w, W_FunctionObject.PUBLIC)
return self

@classdef.method("protected")
def method_protected(self, space, args_w):
self.set_visibility(space, args_w, W_FunctionObject.PROTECTED)
return self

@classdef.method("private_constant")
def method_private_constant(self, space, args_w):

0 comments on commit 845a21b

Please sign in to comment.
You can’t perform that action at this time.