Since Ruby forbid _Foo, what is the convention for internal class/method
name? Currently I use Foo_, but I wonder what other people use.
What do you mean by "internal"? A class that shouldn't be accessed by
classes other than the one you are writing (that is, it is an
implementation detail)?
If I write a class, I tend to expect to re-use it, so I rarely do this.
But if I do write a class that other code shouldn't have access to, I
have been known to put it in a class variable:
class Foo
@@bar = Class.new
@@bar.class_eval do
def foo
puts "foo!"
end
end
def initialize
@bar = @@bar.new
@bar.foo()
end
end
or in 1.8:
class Foo
@@bar = Class.new do
def foo
puts "foo!"
end
end
end
Paul