lib/roda/plugins/default_headers.rb
# Optimize the response class set_default_headers method if it hasn't been
# overridden and all default headers are strings.
Optimize the response class set_default_headers method if it hasn't been
overridden and all default headers are strings.
Optimize the response class set_default_headers method if it hasn ' t been overridden and all default headers are strings .
def freeze
          if (headers = opts[:default_headers]).all?{|k, v| k.is_a?(String) && v.is_a?(String)} &&
             (self::RodaResponse.instance_method(:set_default_headers).owner == Base::ResponseMethods)
            self::RodaResponse.class_eval(<<-END, __FILE__, __LINE__+1)
              private
              def set_default_headers
                h = @headers
                #{headers.map{|k,v| "h[#{k.inspect}] ||= #{v.inspect}"}.join('; ')}
              end
            END
          end
          super
        end
def freeze if ( headers = opts [ :default_headers ] ) . all? { | k , v | k . is_a? ( String ) && v . is_a? ( String ) } && ( self :: RodaResponse . instance_method ( :set_default_headers ) . owner == Base :: ResponseMethods ) self :: RodaResponse . class_eval ( <<-END , __FILE__ , __LINE__ + 1 ) 
              private

              def set_default_headers
                h = @headers
                 #{ headers . map { | k , v | "h[#{k.inspect}] ||= #{v.inspect}" } . join ( '; ' ) } 
              end
             END end super end
Optimize the response class set_default_headers method if it hasn't been
overridden and all default headers are strings.
Optimize the response class set_default_headers method if it hasn ' t been overridden and all default headers are strings .