module Roda::RodaPlugins::DefaultHeaders::ClassMethods
Public Instance Methods
Source
# File lib/roda/plugins/default_headers.rb, line 31 def default_headers opts[:default_headers] end
The default response headers to use for the current class.
Source
# File lib/roda/plugins/default_headers.rb, line 37 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.
Calls superclass method