D
Demonic Software
[Note: parts of this message were removed to make it a legal post.]
Hello,
Is there a way to name all the methods and attributes/ class instantiated
variables that have been created? For example, from the class below, I
would like to get all the variables instantiated from the initialize and
example methods, and then I would also like to be able to get the method
names.
#pseudo code, not sure if it really runs
class Foo
def initialize()
@thestring = ''
@haha = "HA HA HAA!"
@var = "I am a variable"
end
def example(arg)
@arg = arg
@thestring = "#{@haha} #{@var}: #{arg}"
end
def thestring
@thestring
end
end
So is there a way to extract ["thestring", "var", "haha", "arg"] for the
variable names and then ["initialize", "example", "thestring"] for the
method names. I can see how I would do it with regular expressions and
ruby2ruby, but I was wondering if there was another way of extracting the
information. Thanks in advance.
Hello,
Is there a way to name all the methods and attributes/ class instantiated
variables that have been created? For example, from the class below, I
would like to get all the variables instantiated from the initialize and
example methods, and then I would also like to be able to get the method
names.
#pseudo code, not sure if it really runs
class Foo
def initialize()
@thestring = ''
@haha = "HA HA HAA!"
@var = "I am a variable"
end
def example(arg)
@arg = arg
@thestring = "#{@haha} #{@var}: #{arg}"
end
def thestring
@thestring
end
end
So is there a way to extract ["thestring", "var", "haha", "arg"] for the
variable names and then ["initialize", "example", "thestring"] for the
method names. I can see how I would do it with regular expressions and
ruby2ruby, but I was wondering if there was another way of extracting the
information. Thanks in advance.