Hi all -
I'm extending the String class to include a tidy_up_html() method that runs the string using tidy. Works great. However, I'd like to also have a tidy_up_html!() method and do it in place.
The problem is that the tidy library *has* to return a new value, so at some point I have to do:
self = ......
at which point I get the error: Can't change the value of self
Here's a trivial example:
class String
def my_func!
self.gsub!(/x/, 'y') #okay
self = result_of_tidy_call #not okay
end
end
I'm new enough to ruby that I can't figure out how to work around this...
Suggestions?
Thanks!
-philip