C
Charles Calvert
Using Ruby 1.8.6.
I've run into an instance in which I'd like to set attributes of an
instance using the send method. I've looked around, but found
nothing, most likely because I'm using the wrong search terms.
Example:
class A
attr_reader :foo
attr_writer :foo
end
a = A.new
a.send("foo", "newval")
I get the following error: "wrong number of arguments (1 for 0)
(ArgumentError)"
Am I correct in thinking that this is possible, and that I'm just
going about it the wrong way?
I've run into an instance in which I'd like to set attributes of an
instance using the send method. I've looked around, but found
nothing, most likely because I'm using the wrong search terms.
Example:
class A
attr_reader :foo
attr_writer :foo
end
a = A.new
a.send("foo", "newval")
I get the following error: "wrong number of arguments (1 for 0)
(ArgumentError)"
Am I correct in thinking that this is possible, and that I'm just
going about it the wrong way?