"Patrick Hurley" <phurley / gmail.com> submitted:
>I am a ruby newbie, so be kind. I wrote the code myself, but blatantly
> stole Dave Burt's test cases - thank you. I also found one test case

Quiz tests are for sharing - I think that's established. In any case, you're
welcome to them.

> that breaks my code (and Dave's) that I am not sure what the correct
> answer is, but I know mine is wrong:
>
> Consider:
> "===
>                 \n"
> which will cause a new space to be found at the end of a string - is
> it the case that all space at the end of the line is encoded
> (increasing size rather needlessly), but simplifying this case? Either
> way, I am too tired and have other important stuff to do so I will let
> it go.

I see no problem. I've added that test case, and both our solutions
pass.

http://www.dave.burt.id.au/ruby/test-quoted-printable.rb

> Please feel free to let me know where I did not do things the "Ruby
> way" as I am primarily a C++ and Perl guy, but very interested in
> getting better at Ruby.
> ...
>                  /[^!-<>-~\s]/

Bug: "\f" doesn't get escaped (it's part of /\s/). Probably "\r" as well; 
that's harder to test on windows.

I see no other problems. Your optparse is better (i.e. shorter) than mine 
:). Your 
(/(?:(?:[^\n]{74}(?==[\dA-F]{2}))|(?:[^\n]{0,76}(?=\n))|(?:[^\n]{1,75}(?!\n{2})))(?:#{$/}*)/) 
makes you look like a Perl 5 junkie, though. Also, you use global 
variables - we rubyists shun these: use locals.

Cheers,
Dave