If I understand it correctly, I question the approach altogether. Reasons:
1) metaprogramming should be done as a last resort, when less obtuse approaches fail to satisfy the need,
2) the variable stuff in question is code/functionality, and should be expressed as such -- expressing it as a string and then eval'ing it, etc., is redundant and overly complex, and
3) this approach will, to some extent, conceal to the human reader, and definitely to the code editor, analysis tool, etc., what is really going on.
One alternative approach would be a hash whose keys are the attribute names, and values are the code to apply to the values, essentially a lookup table for attribute processing functionality, e.g.
ATTRIBUTE_PROCESSORS = {
price: ->(line) { line.gsub(/,/, '').scan(/\d{3,9}/).first },
model: ->(line) { line.rm_dirty.split(":").last.strip },
location: ->(line) { line.split(":").last.strip }
}
...and call it like this:
ATTRIBUTE_PROCESSORS[:price].(line)
A side benefit of this is that all your attribute processing is colocated, so you can easily spot duplication, and refactor as appropriate.
regex_strnormally like?@product.pricepart, what aboutmodelandlocation?