Passing attr_accessor as method parameter

Hi

Is it possible to pass a variable that was created with attr_accessor as
a method parameter? If so, would you have an example?

Here’s an example of what I’m trying to do:

class thisClass
attr_accessor :my_class
another_class.doSomething(my_class)
end

I’ve also tried passing it as @my_class and :my_class

What I get is “Error: undefined method ‘my_class’”

So what I’d like is to have the same my_class functionality in
another_class as I do in thisClass.

Thanks…

Mike

Mike S. wrote in post #1167452:

Is it possible to pass a variable that was created with attr_accessor as
a method parameter? If so, would you have an example?

I am not sure I understand what you are trying to achieve.

So what I’d like is to have the same my_class functionality in
another_class as I do in thisClass.

Put it in a module and include that in both classes. Or just define the
same attr_accessor in both classes.

Kind regards

robert