def block_to_string &block
      result = block.call.to_s.strip
      unless result.is_a?(String) && result[/^lambda\s*(\{|do).+(\}|end)/xm]
        result = "lambda { #{result} }"
      end
      result.gsub("\n", ";")
    end
def block_to_string &block
      result = block.call.to_s.strip
      unless result.is_a?(String) && result[/^lambda\s*(\{|do).+(\}|end)/xm]
        result = "lambda { #{result} }"
      end
      result.gsub("\n", ";")
    end
Takes a block and either returns the result (if it returns "lambda { … }")
 or builds the lambda string with the result of the block in it.

 Returns a string in the format "lambda { … }"