Yah, I can certainly put the assignment outside the ternary operator, e.g. like so:

        facts_data = request.options.has_key?(:facts_data) ? text_facts :
                                                             CGI.unescape(text_facts)

(Also this version uses has_key? rather than returning hash value just to check that it exists.  I should have done that in the first place.)

I can't remove the use of text_facts above without reworking the logic that raises ArgumentError if there's no fact_format and the logic handling the case where the facts are already actually a Puppet::Node::Facts (which, per the comment, happens if they come in as yaml).