Hi,
In message "[ruby-talk:03233] Making a class method private"
on 00/06/09, "David Douthitt" <DDouthitt / cuna.com> writes:
|class Foo
| def Foo.one
| [ "one", "two", "three" ]
| end
|
| private Foo.one
|
| def Foo.two
| Foo.one.each { |el|
| print "howdy, ", el, "!\n"
| }
| end
|end
|
|It returns:
|
|./test:11:in `private': failed to convert Array into Integer (TypeError)
| from ./test:11
`private' takes symbol (identifier object, represented by Fixnum in
1.4.4), and makes visibility of instance method into private. If you
want to change visibility of class method, you use either
(a) use `private_class_method', e.g.
private_class_method :one
(b) use individual class difinition, e.g.
class Foo
class <<Foo
def one
...
end
private :one
end
end
Hope this helps
matz.