class BreezyPDF::Intercept::Base
:nodoc
Attributes
app[R]
env[R]
Public Class Methods
new(app, env)
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 11 def initialize(app, env) @app = app @env = env @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) end
Private Instance Methods
base_url()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 37 def base_url "#{scheme}://#{env['SERVER_NAME']}#{port}" end
metadata()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 23 def metadata BreezyPDF.default_metadata.merge( "requested_url" => requested_url, "rendered_url" => rendered_url ) end
path()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 45 def path env["PATH_INFO"].gsub(/\.pdf/, "") end
port()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 41 def port ":#{env['SERVER_PORT']}" unless [80, 443].include?(env["SERVER_PORT"].to_i) end
query_string()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 49 def query_string return "" if env["QUERY_STRING"].nil? env["QUERY_STRING"] == "" ? "" : "?#{env['QUERY_STRING']}" end
rendered_url()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 29 def rendered_url "#{base_url}#{path}#{query_string}" end
requested_url()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 33 def requested_url "#{base_url}#{env['PATH_INFO']}#{query_string}" end
timing()
click to toggle source
# File lib/breezy_pdf/intercept/base.rb, line 19 def timing @timing ||= Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time end