Instead of this:
class SomeLongClassName
def SomeLongClassName.method1
…
end
def SomeLongClassName.method2
…
end
end
is there some sort of shorthand like this:
class SomeLongClassName
def @method1
…
end
def @method2
…
end
end
I find that sometimes I make some classes whose methods are all
class methods (like in procedural programming), so it would be a minor
convenience if I didn’t have to repeat the class name each time.
Philip, try this:
class SomeLongClassName
def SomeLongClassName.method1
…
end
def SomeLongClassName.method2
…
end
end
is there some sort of shorthand like this:
Class SomeLongClassName
class << self
def method1
...
end
def method2
...
end
end
end
Cheers, Hannes
Hmm, I always just use:
class SomeClass
def self.class_method
end
end
SomeClass.class_method
Is this what you are looking for?
···
On Mon, Jul 08, 2002 at 05:36:20PM +0900, Philip Mak wrote:
Instead of this:
class SomeLongClassName
def @method1
…
end
def @method2
…
end
end
–
Jim Freeze
If only I had something clever to say for my comment…
~