S
Sirisha Pusapati
Hi,
I have a class called ClassFromString and it has a method called
getCounterValue. It takes a parameter called name. Is there in Ruby
using reflection to get the name of the parameters of a method.
class ClassFromString
@@counter = 0
def initialize
@@counter += 1
end
def getCounterValue(name)
puts name
end
end
def createClassFromString(classname)
ObjectSpace.each_object(Class) do |x|
if x.name == classname
object = x.new
for method in object.public_methods(false)=> Here I want to get the
parameters that are supported by the function
object.send(method,"Sirisha hi htere")
end
end
end
end
createClassFromString("ClassFromString")
I have a class called ClassFromString and it has a method called
getCounterValue. It takes a parameter called name. Is there in Ruby
using reflection to get the name of the parameters of a method.
class ClassFromString
@@counter = 0
def initialize
@@counter += 1
end
def getCounterValue(name)
puts name
end
end
def createClassFromString(classname)
ObjectSpace.each_object(Class) do |x|
if x.name == classname
object = x.new
for method in object.public_methods(false)=> Here I want to get the
parameters that are supported by the function
object.send(method,"Sirisha hi htere")
end
end
end
end
createClassFromString("ClassFromString")