class Jekyll::Commands::Serve::SkipAnalyzer
This class is used to determine if the Servlet
should modify a served file to insert the LiveReload script tags
Constants
- BAD_USER_AGENTS
Public Class Methods
Source
# File lib/jekyll/commands/serve/servlet.rb, line 17 def initialize(request, response, options) @options = options @request = request @response = response end
Source
# File lib/jekyll/commands/serve/servlet.rb, line 13 def self.skip_processing?(request, response, options) new(request, response, options).skip_processing? end
Public Instance Methods
Source
# File lib/jekyll/commands/serve/servlet.rb, line 35 def bad_browser? BAD_USER_AGENTS.any? { |pattern| pattern.match?(@request["User-Agent"]) } end
Source
# File lib/jekyll/commands/serve/servlet.rb, line 27 def chunked? @response["Transfer-Encoding"] == "chunked" end
Source
# File lib/jekyll/commands/serve/servlet.rb, line 39 def html? @response["Content-Type"].to_s.include?("text/html") end
Source
# File lib/jekyll/commands/serve/servlet.rb, line 31 def inline? @response["Content-Disposition"].to_s.start_with?("inline") end
Source
# File lib/jekyll/commands/serve/servlet.rb, line 23 def skip_processing? !html? || chunked? || inline? || bad_browser? end