Is there any way to assign an attribute to a method? I know you can do it with classes, but I have a series of similar methods and it would really be helpful if I could assign each one an attribute. Does anyone know how to do it or if it is even possible in Ruby?
Edit: What I basically mean is that when you have a class you can assign attributes to it like this:
class Person
attr_accessor :age
...
end
I'm wondering if it's also possible to do that with methods, like this:
class Trucks
def get_fire_truck_name
attr_accessor :size
...
end
end
(Btw this is just an example. The actual program is much more complex which explains why I can't simply turn my methods into classes in order to give them attributes.)