T
treefrog
Hi,
I'm trying to work out how to access Class methods when I only have the
class symbol
class Foo
def Foo.hello
puts "Hello Foo"
end
end
class Bar
def Bar.hello
puts "Hello Bar"
end
end
str="Foo"
# I could do this, but there must be a better way.
eval "#{str}.hello"
Kernel doesn't have send, so I can't pass the class as a symbol to
Kernel, and then send the method.
Any ideas?
Cheers
Steve
I'm trying to work out how to access Class methods when I only have the
class symbol
class Foo
def Foo.hello
puts "Hello Foo"
end
end
class Bar
def Bar.hello
puts "Hello Bar"
end
end
str="Foo"
# I could do this, but there must be a better way.
eval "#{str}.hello"
Kernel doesn't have send, so I can't pass the class as a symbol to
Kernel, and then send the method.
Any ideas?
Cheers
Steve