maybe a dummy question. sorry.
class Base
def theName
# the name i would like return should be "Question" mean the name of the class
# calling this function
end
end
class Question < Base
def get( name )
File.open( theName, 'r' ).each { | line |
puts line
}
end
end
how can i get the name "Question" in a String. I need this as an identifier.
thanks
Karl-Heinz
I think that what you want is self.class.name --
class Base
def theName
self.class.name
end
end
···
On Mon, 2004-06-21 at 07:19 +0900, Karl-Heinz Wild wrote:
maybe a dummy question. sorry.
class Base
def theName
# the name i would like return should be "Question" mean the name of
the class
# calling this function
end
end
class Question < Base
def get( name )
File.open( theName, 'r' ).each { | line |
puts line
}
end
end
how can i get the name "Question" in a String. I need this as an
identifier.