K
Kyle Schmitt
How do you go about passing arrays as arguments to something like
method_missing? I've got a method that takes an array as an argument,
but calling it via method_missing is proving problematic. How do you
deal with arrays in these situations?
def table_row(values)
# values is the list of items in the table row
#....
end
def method_missing(method,*args)
if respond_to?method.to_s[/^add_([^$]+)/,1]
@data<<method(method.to_s[/^add_([^$]+)/,1]).call(*args)
else
super method_missing(method,*args)
end
end
--Kyle
method_missing? I've got a method that takes an array as an argument,
but calling it via method_missing is proving problematic. How do you
deal with arrays in these situations?
def table_row(values)
# values is the list of items in the table row
#....
end
def method_missing(method,*args)
if respond_to?method.to_s[/^add_([^$]+)/,1]
@data<<method(method.to_s[/^add_([^$]+)/,1]).call(*args)
else
super method_missing(method,*args)
end
end
--Kyle