S
Sandworth Meb
Hi,
I would like to be able to have something like:
A class with a private method "jim" which can be called on objects of
the class, when self is the class.
i.e. like:
class Kam
def self.call_private
kam=Kam.new
kam.private_method
end
private
def private_method
puts "can't do that"
end
end
Kam.call_private #exception: called private method
Since this doesn't work, is something like this possible? Or is this
sort of thing supposed to be bad design? It seems natural enough to me.
I would like to be able to have something like:
A class with a private method "jim" which can be called on objects of
the class, when self is the class.
i.e. like:
class Kam
def self.call_private
kam=Kam.new
kam.private_method
end
private
def private_method
puts "can't do that"
end
end
Kam.call_private #exception: called private method
Since this doesn't work, is something like this possible? Or is this
sort of thing supposed to be bad design? It seems natural enough to me.