以下のログは下記コードの実行後に生成されたマークダウンファイルとなります。
env = Rack::MockRequest.env_for('http://localhost:3000/books')
TraceLocation.trace(ignore: /rbenv|activesupport/) { status, headers, body = Rails.application.call(env) }
Generated by trace_location at 2019-06-06 10:43:54 +0900
railties-5.2.3/lib/rails.rb:39
def application
@application ||= (app_class.instance if app_class)
end
# called from (irb):3
railties-5.2.3/lib/rails/engine.rb:522
def call(env)
req = build_request env
app.call req.env
end
# called from (irb):3
railties-5.2.3/lib/rails/application.rb:607
def build_request(env)
req = super
env["ORIGINAL_FULLPATH"] = req.fullpath
env["ORIGINAL_SCRIPT_NAME"] = req.script_name
req
end
# called from railties-5.2.3/lib/rails/engine.rb:523
railties-5.2.3/lib/rails/engine.rb:705
def build_request(env)
req = super
env["ORIGINAL_FULLPATH"] = req.fullpath
env["ORIGINAL_SCRIPT_NAME"] = req.script_name
req
end
# called from railties-5.2.3/lib/rails/application.rb:608
railties-5.2.3/lib/rails/application.rb:247
def env_config
@app_env_config ||= begin
super.merge(
"action_dispatch.parameter_filter" => config.filter_parameters,
"action_dispatch.redirect_filter" => config.filter_redirect,
"action_dispatch.secret_token" => secrets.secret_token,
"action_dispatch.secret_key_base" => secret_key_base,
"action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
"action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local,
"action_dispatch.logger" => Rails.logger,
"action_dispatch.backtrace_cleaner" => Rails.backtrace_cleaner,
"action_dispatch.key_generator" => key_generator,
"action_dispatch.http_auth_salt" => config.action_dispatch.http_auth_salt,
"action_dispatch.signed_cookie_salt" => config.action_dispatch.signed_cookie_salt,
"action_dispatch.encrypted_cookie_salt" => config.action_dispatch.encrypted_cookie_salt,
"action_dispatch.encrypted_signed_cookie_salt" => config.action_dispatch.encrypted_signed_cookie_salt,
"action_dispatch.authenticated_encrypted_cookie_salt" => config.action_dispatch.authenticated_encrypted_cookie_salt,
"action_dispatch.use_authenticated_cookie_encryption" => config.action_dispatch.use_authenticated_cookie_encryption,
"action_dispatch.encrypted_cookie_cipher" => config.action_dispatch.encrypted_cookie_cipher,
"action_dispatch.signed_cookie_digest" => config.action_dispatch.signed_cookie_digest,
"action_dispatch.cookies_serializer" => config.action_dispatch.cookies_serializer,
"action_dispatch.cookies_digest" => config.action_dispatch.cookies_digest,
"action_dispatch.cookies_rotations" => config.action_dispatch.cookies_rotations,
"action_dispatch.content_security_policy" => config.content_security_policy,
"action_dispatch.content_security_policy_report_only" => config.content_security_policy_report_only,
"action_dispatch.content_security_policy_nonce_generator" => config.content_security_policy_nonce_generator
)
end
end
# called from railties-5.2.3/lib/rails/engine.rb:706
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from railties-5.2.3/lib/rails/engine.rb:707
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
railties-5.2.3/lib/rails/engine.rb:534
def routes
@routes ||= ActionDispatch::Routing::RouteSet.new_with_config(config)
@routes.append(&Proc.new) if block_given?
@routes
end
# called from railties-5.2.3/lib/rails/engine.rb:708
actionpack-5.2.3/lib/action_dispatch/http/request.rb:142
def routes=(routes) # :nodoc:
set_header("action_dispatch.routes".freeze, routes)
end
# called from railties-5.2.3/lib/rails/engine.rb:708
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:143
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from railties-5.2.3/lib/rails/engine.rb:709
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
actionpack-5.2.3/lib/action_dispatch/http/request.rb:150
def engine_script_name=(name) # :nodoc:
set_header(routes.env_key, name.dup)
end
# called from railties-5.2.3/lib/rails/engine.rb:709
actionpack-5.2.3/lib/action_dispatch/http/request.rb:138
def routes # :nodoc:
get_header("action_dispatch.routes".freeze)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:151
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:139
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:151
actionpack-5.2.3/lib/action_dispatch/http/request.rb:238
def fullpath
@fullpath ||= super
end
# called from railties-5.2.3/lib/rails/application.rb:609
rack-2.0.7/lib/rack/request.rb:407
def fullpath
@fullpath ||= super
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:239
rack-2.0.7/lib/rack/request.rb:136
def query_string; get_header(QUERY_STRING).to_s end
# called from rack-2.0.7/lib/rack/request.rb:408
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:136
rack-2.0.7/lib/rack/request.rb:403
def path
script_name + path_info
end
# called from rack-2.0.7/lib/rack/request.rb:408
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from railties-5.2.3/lib/rails/application.rb:610
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
railties-5.2.3/lib/rails/engine.rb:505
def app
@app || @app_build_lock.synchronize {
@app ||= begin
stack = default_middleware_stack
config.middleware = build_middleware.merge_into(stack)
config.middleware.build(endpoint)
end
}
end
# called from railties-5.2.3/lib/rails/engine.rb:524
rack-2.0.7/lib/rack/sendfile.rb:110
def call(env)
status, headers, body = @app.call(env)
if body.respond_to?(:to_path)
case type = variation(env)
when 'X-Accel-Redirect'
path = ::File.expand_path(body.to_path)
if url = map_accel_path(env, path)
headers[CONTENT_LENGTH] = '0'
headers[type] = url
obody = body
body = Rack::BodyProxy.new([]) do
obody.close if obody.respond_to?(:close)
end
else
env[RACK_ERRORS].puts "X-Accel-Mapping header missing"
end
when 'X-Sendfile', 'X-Lighttpd-Send-File'
path = ::File.expand_path(body.to_path)
headers[CONTENT_LENGTH] = '0'
headers[type] = path
obody = body
body = Rack::BodyProxy.new([]) do
obody.close if obody.respond_to?(:close)
end
when '', nil
else
env[RACK_ERRORS].puts "Unknown x-sendfile variation: '#{type}'.\n"
end
end
[status, headers, body]
end
# called from railties-5.2.3/lib/rails/engine.rb:524
actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:116
def call(env)
req = Rack::Request.new env
if req.get? || req.head?
path = req.path_info.chomp("/".freeze)
if match = @file_handler.match?(path)
req.path_info = match
return @file_handler.serve(req)
end
end
@app.call(req.env)
end
# called from rack-2.0.7/lib/rack/sendfile.rb:111
rack-2.0.7/lib/rack/request.rb:16
def initialize(env)
@params = nil
super(env)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:117
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
@params = nil
super(env)
end
# called from rack-2.0.7/lib/rack/request.rb:18
rack-2.0.7/lib/rack/request.rb:162
def get?; request_method == GET end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:119
rack-2.0.7/lib/rack/request.rb:135
def request_method; get_header(REQUEST_METHOD) end
# called from rack-2.0.7/lib/rack/request.rb:162
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:135
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:120
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:30
def match?(path)
path = ::Rack::Utils.unescape_path path
return false unless ::Rack::Utils.valid_path? path
path = ::Rack::Utils.clean_path_info path
paths = [path, "#{path}#{ext}", "#{path}/#{@index}#{ext}"]
if match = paths.detect { |p|
path = File.join(@root, p.b)
begin
File.file?(path) && File.readable?(path)
rescue SystemCallError
false
end
}
return ::Rack::Utils.escape_path(match).b
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:121
rack-2.0.7/lib/rack/utils.rb:42
def unescape_path(s)
::URI::DEFAULT_PARSER.unescape s
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:31
rack-2.0.7/lib/rack/utils.rb:614
def valid_path?(path)
path.valid_encoding? && !path.include?(NULL_BYTE)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:32
rack-2.0.7/lib/rack/utils.rb:596
def clean_path_info(path_info)
parts = path_info.split PATH_SEPS
clean = []
parts.each do |part|
next if part.empty? || part == '.'
part == '..' ? clean.pop : clean << part
end
clean.unshift '/' if parts.empty? || parts.first.empty?
::File.join(*clean)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:33
actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:78
def ext
::ActionController::Base.default_static_extension
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:35
actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:78
def ext
::ActionController::Base.default_static_extension
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:35
actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:11
def call(env)
state = @executor.run!
begin
response = @app.call(env)
returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
ensure
state.complete! unless returned
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:127
rack-2.0.7/lib/rack/runtime.rb:20
def call(env)
start_time = Utils.clock_time
status, headers, body = @app.call(env)
request_time = Utils.clock_time - start_time
unless headers.has_key?(@header_name)
headers[@header_name] = FORMAT_STRING % request_time
end
[status, headers, body]
end
# called from activesupport-5.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29
rack-2.0.7/lib/rack/utils.rb:81
def clock_time
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from rack-2.0.7/lib/rack/runtime.rb:21
actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:24
def call(env)
req = ActionDispatch::Request.new env
req.request_id = make_request_id(req.x_request_id)
@app.call(env).tap { |_status, headers, _body| headers[X_REQUEST_ID] = req.request_id }
end
# called from rack-2.0.7/lib/rack/runtime.rb:22
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:25
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:26
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:31
def make_request_id(request_id)
if request_id.presence
request_id.gsub(/[^\w\-@]/, "".freeze).first(255)
else
internal_request_id
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:26
actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:39
def internal_request_id
SecureRandom.uuid
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:35
actionpack-5.2.3/lib/action_dispatch/http/request.rb:298
def request_id=(id) # :nodoc:
set_header ACTION_DISPATCH_REQUEST_ID, id
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:26
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:299
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:78
def call(env)
req = ActionDispatch::Request.new env
req.remote_ip = GetIp.new(req, check_ip, proxies)
@app.call(req.env)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:27
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:79
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:88
def initialize(req, check_ip, proxies)
@req = req
@check_ip = check_ip
@proxies = proxies
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:80
actionpack-5.2.3/lib/action_dispatch/http/request.rb:282
def remote_ip=(remote_ip)
set_header "action_dispatch.remote_ip".freeze, remote_ip
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:80
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:283
railties-5.2.3/lib/rails/rack/logger.rb:22
def call(env)
request = ActionDispatch::Request.new(env)
if logger.respond_to?(:tagged)
logger.tagged(compute_tags(request)) { call_app(request, env) }
else
call_app(request, env)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:81
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:23
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
railties-5.2.3/lib/rails/rack/logger.rb:75
def logger
Rails.logger
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:25
railties-5.2.3/lib/rails/rack/logger.rb:75
def logger
Rails.logger
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:26
railties-5.2.3/lib/rails/rack/logger.rb:57
def compute_tags(request) # :doc:
@taggers.collect do |tag|
case tag
when Proc
tag.call(request)
when Symbol
request.send(tag)
else
tag
end
end
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:26
railties-5.2.3/lib/rails/rack/logger.rb:34
def call_app(request, env) # :doc:
instrumenter = ActiveSupport::Notifications.instrumenter
instrumenter.start "request.action_dispatch", request: request
logger.info { started_request_message(request) }
status, headers, body = @app.call(env)
body = ::Rack::BodyProxy.new(body) { finish(request) }
[status, headers, body]
rescue Exception
finish(request)
raise
ensure
ActiveSupport::LogSubscriber.flush_all!
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:26
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
railties-5.2.3/lib/rails/rack/logger.rb:75
def logger
Rails.logger
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:37
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
railties-5.2.3/lib/rails/rack/logger.rb:49
def started_request_message(request) # :doc:
'Started %s "%s" for %s at %s' % [
request.request_method,
request.filtered_path,
request.remote_ip,
Time.now.to_default_s ]
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:37
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:51
rack-2.0.7/lib/rack/request.rb:135
def request_method
@request_method ||= check_method(super)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:135
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:135
actionpack-5.2.3/lib/action_dispatch/http/request.rb:425
def check_method(name)
HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS[0...-1].join(', ')}, and #{HTTP_METHODS[-1]}")
name
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:135
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:52
def filtered_path
@filtered_path ||= query_string.empty? ? path : "#{path}?#{filtered_query_string}"
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:52
rack-2.0.7/lib/rack/request.rb:136
def query_string; get_header(QUERY_STRING).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:53
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:136
rack-2.0.7/lib/rack/request.rb:403
def path
script_name + path_info
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:53
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/http/request.rb:278
def remote_ip
@remote_ip ||= (get_header("action_dispatch.remote_ip") || ip).to_s
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:53
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:279
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:154
def to_s
@ip ||= calculate_ip
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:279
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:112
def calculate_ip
# Set by the Rack web server, this is a single value.
remote_addr = ips_from(@req.remote_addr).last
# Could be a CSV list and/or repeated headers that were concatenated.
client_ips = ips_from(@req.client_ip).reverse
forwarded_ips = ips_from(@req.x_forwarded_for).reverse
# +Client-Ip+ and +X-Forwarded-For+ should not, generally, both be set.
# If they are both set, it means that either:
#
# 1) This request passed through two proxies with incompatible IP header
# conventions.
# 2) The client passed one of +Client-Ip+ or +X-Forwarded-For+
# (whichever the proxy servers weren't using) themselves.
#
# Either way, there is no way for us to determine which header is the
# right one after the fact. Since we have no idea, if we are concerned
# about IP spoofing we need to give up and explode. (If you're not
# concerned about IP spoofing you can turn the +ip_spoofing_check+
# option off.)
should_check_ip = @check_ip && client_ips.last && forwarded_ips.last
if should_check_ip && !forwarded_ips.include?(client_ips.last)
# We don't know which came from the proxy, and which from the user
raise IpSpoofAttackError, "IP spoofing attack?! " \
"HTTP_CLIENT_IP=#{@req.client_ip.inspect} " \
"HTTP_X_FORWARDED_FOR=#{@req.x_forwarded_for.inspect}"
end
# We assume these things about the IP headers:
#
# - X-Forwarded-For will be a list of IPs, one per proxy, or blank
# - Client-Ip is propagated from the outermost proxy, or is blank
# - REMOTE_ADDR will be the IP that made the request to Rack
ips = [forwarded_ips, client_ips, remote_addr].flatten.compact
# If every single IP option is in the trusted list, just return REMOTE_ADDR
filter_proxies(ips).first || remote_addr
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:155
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:114
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:114
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:117
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:117
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:118
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:118
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:176
def filter_proxies(ips) # :doc:
ips.reject do |ip|
@proxies.any? { |proxy| proxy === ip }
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:149
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
railties-5.2.3/lib/rails/rack/logger.rb:49
def started_request_message(request) # :doc:
'Started %s "%s" for %s at %s' % [
request.request_method,
request.filtered_path,
request.remote_ip,
Time.now.to_default_s ]
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:37
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:51
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:52
def filtered_path
@filtered_path ||= query_string.empty? ? path : "#{path}?#{filtered_query_string}"
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:52
actionpack-5.2.3/lib/action_dispatch/http/request.rb:278
def remote_ip
@remote_ip ||= (get_header("action_dispatch.remote_ip") || ip).to_s
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:53
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:279
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:154
def to_s
@ip ||= calculate_ip
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:279
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:112
def calculate_ip
# Set by the Rack web server, this is a single value.
remote_addr = ips_from(@req.remote_addr).last
# Could be a CSV list and/or repeated headers that were concatenated.
client_ips = ips_from(@req.client_ip).reverse
forwarded_ips = ips_from(@req.x_forwarded_for).reverse
# +Client-Ip+ and +X-Forwarded-For+ should not, generally, both be set.
# If they are both set, it means that either:
#
# 1) This request passed through two proxies with incompatible IP header
# conventions.
# 2) The client passed one of +Client-Ip+ or +X-Forwarded-For+
# (whichever the proxy servers weren't using) themselves.
#
# Either way, there is no way for us to determine which header is the
# right one after the fact. Since we have no idea, if we are concerned
# about IP spoofing we need to give up and explode. (If you're not
# concerned about IP spoofing you can turn the +ip_spoofing_check+
# option off.)
should_check_ip = @check_ip && client_ips.last && forwarded_ips.last
if should_check_ip && !forwarded_ips.include?(client_ips.last)
# We don't know which came from the proxy, and which from the user
raise IpSpoofAttackError, "IP spoofing attack?! " \
"HTTP_CLIENT_IP=#{@req.client_ip.inspect} " \
"HTTP_X_FORWARDED_FOR=#{@req.x_forwarded_for.inspect}"
end
# We assume these things about the IP headers:
#
# - X-Forwarded-For will be a list of IPs, one per proxy, or blank
# - Client-Ip is propagated from the outermost proxy, or is blank
# - REMOTE_ADDR will be the IP that made the request to Rack
ips = [forwarded_ips, client_ips, remote_addr].flatten.compact
# If every single IP option is in the trusted list, just return REMOTE_ADDR
filter_proxies(ips).first || remote_addr
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:155
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:114
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:114
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:117
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:117
actionpack-5.2.3/lib/action_dispatch/http/request.rb:49
def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset
get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
end # end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:118
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:50
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:160
def ips_from(header) # :doc:
return [] unless header
# Split the comma-separated list into an array of strings.
ips = header.strip.split(/[,\s]+/)
ips.select do |ip|
begin
# Only return IPs that are valid according to the IPAddr#new method.
range = IPAddr.new(ip).to_range
# We want to make sure nobody is sneaking a netmask in.
range.begin == range.end
rescue ArgumentError
nil
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:118
actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:176
def filter_proxies(ips) # :doc:
ips.reject do |ip|
@proxies.any? { |proxy| proxy === ip }
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:149
actionpack-5.2.3/lib/action_dispatch/middleware/show_exceptions.rb:31
def call(env)
request = ActionDispatch::Request.new env
@app.call(env)
rescue Exception => exception
if request.show_exceptions?
render_exception(request, exception)
else
raise exception
end
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:38
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/show_exceptions.rb:32
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:59
def call(env)
request = ActionDispatch::Request.new env
_, headers, body = response = @app.call(env)
if headers["X-Cascade"] == "pass"
body.close if body.respond_to?(:close)
raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
end
response
rescue Exception => exception
raise exception unless request.show_exceptions?
render_exception(request, exception)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/show_exceptions.rb:33
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:60
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:11
def call(env)
state = @executor.run!
begin
response = @app.call(env)
returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
ensure
state.complete! unless returned
end
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:61
concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb:27
def true?
synchronize { @value }
end
# called from activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb:78
concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb:37
def synchronize
if @__Lock__.owned?
yield
else
@__Lock__.synchronize { yield }
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb:28
railties-5.2.3/lib/rails/application/routes_reloader.rb:10
delegate :execute_if_updated, :execute, :updated?, to: :updater
# called from railties-5.2.3/lib/rails/application/finisher.rb:159
railties-5.2.3/lib/rails/application/routes_reloader.rb:29
def updater
@updater ||= ActiveSupport::FileUpdateChecker.new(paths) { reload! }
end
# called from railties-5.2.3/lib/rails/application/routes_reloader.rb:10
concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb:27
def true?
synchronize { @value }
end
# called from activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb:78
concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb:37
def synchronize
if @__Lock__.owned?
yield
else
@__Lock__.synchronize { yield }
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb:28
actionpack-5.2.3/lib/action_dispatch/middleware/callbacks.rb:24
def call(env)
error = nil
result = run_callbacks :call do
begin
@app.call(env)
rescue => error
end
end
raise error if error
result
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:14
activerecord-5.2.3/lib/active_record/migration.rb:553
def call(env)
mtime = ActiveRecord::Base.connection.migration_context.last_migration.mtime.to_i
if @last_check < mtime
ActiveRecord::Migration.check_pending!(connection)
@last_check = mtime
end
@app.call(env)
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/callbacks.rb:28
activerecord-5.2.3/lib/active_record/connection_handling.rb:89
def connection
retrieve_connection
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:554
activerecord-5.2.3/lib/active_record/connection_handling.rb:117
def retrieve_connection
connection_handler.retrieve_connection(connection_specification_name)
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:90
activerecord-5.2.3/lib/active_record/core.rb:130
def self.connection_handler
ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/core.rb:131
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1011
def retrieve_connection(spec_name) #:nodoc:
pool = retrieve_connection_pool(spec_name)
raise ConnectionNotEstablished, "No connection pool with '#{spec_name}' found." unless pool
pool.connection
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1039
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
# Check if a connection was previously established in an ancestor process,
# which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
establish_connection(ancestor_pool.spec.to_hash).tap do |pool|
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
end
else
owner_to_pool[spec_name] = nil
end
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1012
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058
def owner_to_pool
@owner_to_pool[Process.pid]
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1059
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:168
def fetch(key, default_value = NULL)
if NULL != (value = get_or_default(key, NULL))
value
elsif block_given?
yield key
elsif NULL != default_value
default_value
else
raise_fetch_no_key
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:169
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:381
def connection
@thread_cached_conns[connection_cache_key(@lock_thread || Thread.current)] ||= checkout
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1014
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:667
def connection_cache_key(thread)
thread
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:128
def migration_context # :nodoc:
MigrationContext.new(migrations_paths)
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:554
activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:124
def migrations_paths # :nodoc:
@config[:migrations_paths] || Migrator.migrations_paths
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:129
activerecord-5.2.3/lib/active_record/migration.rb:1004
def initialize(migrations_paths)
@migrations_paths = migrations_paths
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:129
activerecord-5.2.3/lib/active_record/migration.rb:1078
def last_migration #:nodoc:
migrations.last || NullMigration.new
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:554
activerecord-5.2.3/lib/active_record/migration.rb:1086
def migrations
migrations = migration_files.map do |file|
version, name, scope = parse_migration_filename(file)
raise IllegalMigrationNameError.new(file) unless version
version = version.to_i
name = name.camelize
MigrationProxy.new(name, version, file, scope)
end
migrations.sort_by(&:version)
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1079
activerecord-5.2.3/lib/active_record/migration.rb:1117
def migration_files
paths = Array(migrations_paths)
Dir[*paths.flat_map { |path| "#{path}/**/[0-9]*_*.rb" }]
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1087
activerecord-5.2.3/lib/active_record/migration.rb:1082
def parse_migration_filename(filename) # :nodoc:
File.basename(filename).scan(Migration::MigrationFilenameRegexp).first
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1088
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/migration.rb:964
def initialize(name, version, filename, scope)
super
@migration = nil
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1093
activerecord-5.2.3/lib/active_record/migration.rb:1082
def parse_migration_filename(filename) # :nodoc:
File.basename(filename).scan(Migration::MigrationFilenameRegexp).first
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1088
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/migration.rb:964
def initialize(name, version, filename, scope)
super
@migration = nil
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:1093
activerecord-5.2.3/lib/active_record/migration.rb:973
def mtime
File.mtime filename
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:554
rack-2.0.7/lib/rack/head.rb:11
def call(env)
status, headers, body = @app.call(env)
if env[REQUEST_METHOD] == HEAD
[
status, headers, Rack::BodyProxy.new([]) do
body.close if body.respond_to? :close
end
]
else
[status, headers, body]
end
end
# called from activerecord-5.2.3/lib/active_record/migration.rb:559
rack-2.0.7/lib/rack/conditional_get.rb:22
def call(env)
case env[REQUEST_METHOD]
when "GET", "HEAD"
status, headers, body = @app.call(env)
headers = Utils::HeaderHash.new(headers)
if status == 200 && fresh?(env, headers)
status = 304
headers.delete(CONTENT_TYPE)
headers.delete(CONTENT_LENGTH)
original_body = body
body = Rack::BodyProxy.new([]) do
original_body.close if original_body.respond_to?(:close)
end
end
[status, headers, body]
else
@app.call(env)
end
end
# called from rack-2.0.7/lib/rack/head.rb:12
rack-2.0.7/lib/rack/etag.rb:24
def call(env)
status, headers, body = @app.call(env)
if etag_status?(status) && etag_body?(body) && !skip_caching?(headers)
original_body = body
digest, new_body = digest_body(body)
body = Rack::BodyProxy.new(new_body) do
original_body.close if original_body.respond_to?(:close)
end
headers[ETAG_STRING] = %(W/"#{digest}") if digest
end
unless headers[CACHE_CONTROL]
if digest
headers[CACHE_CONTROL] = @cache_control if @cache_control
else
headers[CACHE_CONTROL] = @no_cache_control if @no_cache_control
end
end
[status, headers, body]
end
# called from rack-2.0.7/lib/rack/conditional_get.rb:25
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:837
def call(env)
req = make_request(env)
req.path_info = Journey::Router::Utils.normalize_path(req.path_info)
@router.serve(req)
end
# called from rack-2.0.7/lib/rack/etag.rb:25
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:407
def make_request(env)
request_class.new env
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:838
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:403
def request_class
ActionDispatch::Request
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:408
actionpack-5.2.3/lib/action_dispatch/http/request.rb:59
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:408
rack-2.0.7/lib/rack/request.rb:40
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:60
actionpack-5.2.3/lib/action_dispatch/http/url.rb:186
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from rack-2.0.7/lib/rack/request.rb:42
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:34
def initialize(env)
super
@method = nil
@request_method = nil
@remote_ip = nil
@original_fullpath = nil
@fullpath = nil
@ip = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/url.rb:187
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:839
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/router/utils.rb:17
def self.normalize_path(path)
path ||= ""
encoding = path.encoding
path = "/#{path}".dup
path.squeeze!("/".freeze)
path.sub!(%r{/+\Z}, "".freeze)
path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
path = "/".dup if path == "".freeze
path.force_encoding(encoding)
path
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:839
rack-2.0.7/lib/rack/request.rb:133
def path_info=(s); set_header(PATH_INFO, s.to_s) end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:839
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from rack-2.0.7/lib/rack/request.rb:133
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:34
def serve(req)
find_routes(req).each do |match, parameters, route|
set_params = req.path_parameters
path_info = req.path_info
script_name = req.script_name
unless route.path.anchored
req.script_name = (script_name.to_s + match.to_s).chomp("/")
req.path_info = match.post_match
req.path_info = "/" + req.path_info unless req.path_info.start_with? "/"
end
parameters = route.defaults.merge parameters.transform_values { |val|
val.dup.force_encoding(::Encoding::UTF_8)
}
req.path_parameters = set_params.merge parameters
status, headers, body = route.app.serve(req)
if "pass" == headers["X-Cascade"]
req.script_name = script_name
req.path_info = path_info
req.path_parameters = set_params
next
end
return [status, headers, body]
end
[404, { "X-Cascade" => "pass" }, ["Not Found"]]
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:840
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:111
def find_routes(req)
routes = filter_routes(req.path_info).concat custom_routes.find_all { |r|
r.path.match(req.path_info)
}
routes =
if req.head?
match_head_routes(routes, req)
else
match_routes(routes, req)
end
routes.sort_by!(&:precedence)
routes.map! { |r|
match_data = r.path.match(req.path_info)
path_parameters = {}
match_data.names.zip(match_data.captures) { |name, val|
path_parameters[name.to_sym] = Utils.unescape_uri(val) if val
}
[match_data, path_parameters, r]
}
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:112
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:106
def filter_routes(path)
return [] unless ast
simulator.memos(path) { [] }
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:112
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:94
def ast
routes.ast
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:107
actionpack-5.2.3/lib/action_dispatch/journey/routes.rb:51
def ast
@ast ||= begin
asts = anchored_routes.map(&:ast)
Nodes::Or.new(asts)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:95
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:98
def simulator
routes.simulator
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:108
actionpack-5.2.3/lib/action_dispatch/journey/routes.rb:58
def simulator
return if ast.nil?
@simulator ||= begin
gtg = GTG::Builder.new(ast).transition_table
GTG::Simulator.new(gtg)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:99
actionpack-5.2.3/lib/action_dispatch/journey/routes.rb:51
def ast
@ast ||= begin
asts = anchored_routes.map(&:ast)
Nodes::Or.new(asts)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/routes.rb:59
actionpack-5.2.3/lib/action_dispatch/journey/gtg/simulator.rb:23
def memos(string)
input = StringScanner.new(string)
state = [0]
while sym = input.scan(%r([/.?]|[^/.?]+))
state = tt.move(state, sym)
end
acceptance_states = state.find_all { |s|
tt.accepting? s
}
return yield if acceptance_states.empty?
acceptance_states.flat_map { |x| tt.memo(x) }.compact
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:108
actionpack-5.2.3/lib/action_dispatch/journey/gtg/transition_table.rb:44
def move(t, a)
return [] if t.empty?
regexps = []
t.map { |s|
if states = @regexp_states[s]
regexps.concat states.map { |re, v| re === a ? v : nil }
end
if states = @string_states[s]
states[a]
end
}.compact.concat regexps
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/gtg/simulator.rb:27
actionpack-5.2.3/lib/action_dispatch/journey/gtg/transition_table.rb:44
def move(t, a)
return [] if t.empty?
regexps = []
t.map { |s|
if states = @regexp_states[s]
regexps.concat states.map { |re, v| re === a ? v : nil }
end
if states = @string_states[s]
states[a]
end
}.compact.concat regexps
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/gtg/simulator.rb:27
actionpack-5.2.3/lib/action_dispatch/journey/gtg/transition_table.rb:28
def accepting?(state)
@accepting[state]
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/gtg/simulator.rb:31
actionpack-5.2.3/lib/action_dispatch/journey/gtg/transition_table.rb:36
def memo(idx)
@memos[idx]
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/gtg/simulator.rb:36
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:102
def custom_routes
routes.custom_routes
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:112
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:113
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
rack-2.0.7/lib/rack/request.rb:165
def head?; request_method == HEAD end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:117
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from rack-2.0.7/lib/rack/request.rb:165
rack-2.0.7/lib/rack/request.rb:135
def request_method
@request_method ||= check_method(super)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:135
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:135
actionpack-5.2.3/lib/action_dispatch/http/request.rb:425
def check_method(name)
HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS[0...-1].join(', ')}, and #{HTTP_METHODS[-1]}")
name
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:135
actionpack-5.2.3/lib/action_dispatch/journey/router.rb:151
def match_routes(routes, req)
routes.select { |r| r.matches?(req) }
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:120
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:162
def matches?(request)
match_verb(request) &&
constraints.all? { |method, value|
case value
when Regexp, String
value === request.send(method).to_s
when Array
value.include?(request.send(method))
when TrueClass
request.send(method).present?
when FalseClass
request.send(method).blank?
else
value === request.send(method)
end
}
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:152
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:197
def match_verb(request)
@request_method_match.any? { |m| m.call request }
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:163
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:18
def self.call(req); req.#{v.downcase}?; end
end
eoc
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:198
rack-2.0.7/lib/rack/request.rb:162
def get?; request_method == GET end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:18
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from rack-2.0.7/lib/rack/request.rb:162
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:162
def matches?(request)
match_verb(request) &&
constraints.all? { |method, value|
case value
when Regexp, String
value === request.send(method).to_s
when Array
value.include?(request.send(method))
when TrueClass
request.send(method).present?
when FalseClass
request.send(method).blank?
else
value === request.send(method)
end
}
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:152
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:197
def match_verb(request)
@request_method_match.any? { |m| m.call request }
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:163
actionpack-5.2.3/lib/action_dispatch/journey/route.rb:18
def self.call(req); req.#{v.downcase}?; end
end
eoc
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:198
rack-2.0.7/lib/rack/request.rb:177
def post?; request_method == POST end
# called from actionpack-5.2.3/lib/action_dispatch/journey/route.rb:18
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from rack-2.0.7/lib/rack/request.rb:177
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:126
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:157
def match(other)
return unless match = to_regexp.match(other)
MatchData.new(names, offsets, match)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:126
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:167
def to_regexp
@re ||= regexp_visitor.new(@separators, @requirements).accept spec
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:158
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:57
def names
@names ||= spec.find_all(&:symbol?).map(&:name)
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:159
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:177
def offsets
return @offsets if @offsets
@offsets = [0]
spec.find_all(&:symbol?).each do |node|
node = node.to_sym
if @requirements.key?(node)
re = /#{@requirements[node]}|/
@offsets.push((re.match("").length - 1) + @offsets.last)
else
@offsets << @offsets.last
end
end
@offsets
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:159
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:129
def initialize(names, offsets, match)
@names = names
@offsets = offsets
@match = match
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:159
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:135
def captures
Array.new(length - 1) { |i| self[i + 1] }
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:128
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:144
def length
@offsets.length
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:136
actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:139
def [](x)
idx = @offsets[x - 1] + x
@match[idx]
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/path/pattern.rb:136
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:83
def path_parameters
get_header(PARAMETERS_KEY) || set_header(PARAMETERS_KEY, {})
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:36
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:84
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:37
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:38
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:66
def path_parameters=(parameters) #:nodoc:
delete_header("action_dispatch.request.parameters")
parameters = set_binary_encoding(parameters, parameters[:controller], parameters[:action])
# If any of the path parameters has an invalid encoding then
# raise since it's likely to trigger errors further on.
Request::Utils.check_param_encoding(parameters)
set_header PARAMETERS_KEY, parameters
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new("Invalid path parameters: #{e.message}")
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:50
rack-2.0.7/lib/rack/request.rb:92
def delete_header(name)
@env.delete name
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:67
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:89
def set_binary_encoding(params, controller, action)
return params unless controller && controller.valid_encoding?
if binary_params_for?(controller, action)
ActionDispatch::Request::Utils.each_param_value(params) do |param|
param.force_encoding ::Encoding::ASCII_8BIT
end
end
params
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:69
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:100
def binary_params_for?(controller, action)
controller_class_for(controller).binary_params_for?(action)
rescue NameError
false
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:92
actionpack-5.2.3/lib/action_dispatch/http/request.rb:84
def controller_class_for(name)
if name
controller_param = name.underscore
const_name = "#{controller_param.camelize}Controller"
ActiveSupport::Dependencies.constantize(const_name)
else
PASS_NOT_FOUND
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:101
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/dependencies.rb:582
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/metal.rb:139
def self.binary_params_for?(action) # :nodoc:
false
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:101
actionpack-5.2.3/lib/action_dispatch/request/utils.rb:29
def self.check_param_encoding(params)
case params
when Array
params.each { |element| check_param_encoding(element) }
when Hash
params.each_value { |value| check_param_encoding(value) }
when String
unless params.valid_encoding?
# Raise Rack::Utils::InvalidParameterError for consistency with Rack.
# ActionDispatch::Request#GET will re-raise as a BadRequest error.
raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:72
actionpack-5.2.3/lib/action_dispatch/request/utils.rb:29
def self.check_param_encoding(params)
case params
when Array
params.each { |element| check_param_encoding(element) }
when Hash
params.each_value { |value| check_param_encoding(value) }
when String
unless params.valid_encoding?
# Raise Rack::Utils::InvalidParameterError for consistency with Rack.
# ActionDispatch::Request#GET will re-raise as a BadRequest error.
raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/request/utils.rb:34
actionpack-5.2.3/lib/action_dispatch/request/utils.rb:29
def self.check_param_encoding(params)
case params
when Array
params.each { |element| check_param_encoding(element) }
when Hash
params.each_value { |value| check_param_encoding(value) }
when String
unless params.valid_encoding?
# Raise Rack::Utils::InvalidParameterError for consistency with Rack.
# ActionDispatch::Request#GET will re-raise as a BadRequest error.
raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/request/utils.rb:34
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:74
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:30
def serve(req)
params = req.path_parameters
controller = controller req
res = controller.make_response! req
dispatch(controller, params[:action], req, res)
rescue ActionController::RoutingError
if @raise_on_name_error
raise
else
return [404, { "X-Cascade" => "pass" }, []]
end
end
# called from actionpack-5.2.3/lib/action_dispatch/journey/router.rb:52
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:83
def path_parameters
get_header(PARAMETERS_KEY) || set_header(PARAMETERS_KEY, {})
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:31
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:84
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:45
def controller(req)
req.controller_class
rescue NameError => e
raise ActionController::RoutingError, e.message, e.backtrace
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:32
actionpack-5.2.3/lib/action_dispatch/http/request.rb:78
def controller_class
params = path_parameters
params[:action] ||= "index"
controller_class_for(params[:controller])
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:46
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:83
def path_parameters
get_header(PARAMETERS_KEY) || set_header(PARAMETERS_KEY, {})
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:79
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:84
actionpack-5.2.3/lib/action_dispatch/http/request.rb:84
def controller_class_for(name)
if name
controller_param = name.underscore
const_name = "#{controller_param.camelize}Controller"
ActiveSupport::Dependencies.constantize(const_name)
else
PASS_NOT_FOUND
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:81
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/dependencies.rb:582
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/metal.rb:133
def self.make_response!(request)
ActionDispatch::Response.new.tap do |res|
res.request = request
end
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:33
actionpack-5.2.3/lib/action_dispatch/http/response.rb:164
def initialize(status = 200, header = {}, body = [])
super()
@header = Header.new(self, header)
self.body, self.status = body, status
@cv = new_cond
@committed = false
@sending = false
@sent = false
prepare_cache_control!
yield self if block_given?
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:134
actionpack-5.2.3/lib/action_dispatch/http/response.rb:39
def initialize(response, header)
@response = response
super(header)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:167
actionpack-5.2.3/lib/action_dispatch/http/response.rb:312
def body=(body)
if body.respond_to?(:to_path)
@stream = body
else
synchronize do
@stream = build_buffer self, munge_body_object(body)
end
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:169
actionpack-5.2.3/lib/action_dispatch/http/response.rb:456
def munge_body_object(body)
body.respond_to?(:each) ? body : [body]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:317
actionpack-5.2.3/lib/action_dispatch/http/response.rb:452
def build_buffer(response, body)
Buffer.new response, body
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:317
actionpack-5.2.3/lib/action_dispatch/http/response.rb:100
def initialize(response, buf)
@response = response
@buf = buf
@closed = false
@str_body = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:453
actionpack-5.2.3/lib/action_dispatch/http/response.rb:224
def status=(status)
@status = Rack::Utils.status_code(status)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:169
rack-2.0.7/lib/rack/utils.rb:585
def status_code(status)
if status.is_a?(Symbol)
SYMBOL_TO_STATUS_CODE[status] || 500
else
status.to_i
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:225
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:165
def prepare_cache_control!
@cache_control = cache_control_headers
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:176
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:147
def cache_control_headers
cache_control = {}
cache_control_segments.each do |segment|
directive, argument = segment.split("=", 2)
if SPECIAL_KEYS.include? directive
key = directive.tr("-", "_")
cache_control[key.to_sym] = argument || true
else
cache_control[:extras] ||= []
cache_control[:extras] << segment
end
end
cache_control
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:166
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:139
def cache_control_segments
if cache_control = _cache_control
cache_control.delete(" ").split(",")
else
[]
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:150
rack-2.0.7/lib/rack/response.rb:199
attr_reader :cache_control
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:140
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from rack-2.0.7/lib/rack/response.rb:200
actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:51
def dispatch(controller, action, req, res)
controller.dispatch(action, req, res)
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:34
actionpack-5.2.3/lib/action_controller/metal.rb:248
def self.dispatch(name, req, res)
if middleware_stack.any?
middleware_stack.build(name) { |env| new.dispatch(name, req, res) }.call req.env
else
new.dispatch(name, req, res)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:52
actionpack-5.2.3/lib/action_dispatch/middleware/stack.rb:50
def each
@middlewares.each { |x| yield x }
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:249
actionpack-5.2.3/lib/action_dispatch/routing/url_for.rb:106
def initialize(*)
@_routes = nil
super
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:252
actionpack-5.2.3/lib/action_controller/metal.rb:153
def initialize(*)
@_routes = nil
super
end
# called from actionpack-5.2.3/lib/action_dispatch/routing/url_for.rb:108
actionpack-5.2.3/lib/action_controller/metal.rb:188
def dispatch(name, request, response) #:nodoc:
set_request!(request)
set_response!(response)
process(name)
request.commit_flash
to_a
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:252
actionpack-5.2.3/lib/action_controller/metal.rb:200
def set_request!(request) #:nodoc:
@_request = request
@_request.controller_instance = self
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:189
actionpack-5.2.3/lib/action_dispatch/http/request.rb:164
def controller_instance=(controller) # :nodoc:
set_header("action_controller.instance".freeze, controller)
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:202
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:165
actionpack-5.2.3/lib/action_controller/metal.rb:196
def set_response!(response) # :nodoc:
@_response = response
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:190
actionpack-5.2.3/lib/abstract_controller/base.rb:125
def process(action, *args)
@_action_name = action.to_s
unless action_name = _find_action_name(@_action_name)
raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}"
end
@_response_body = nil
process_action(action_name, *args)
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:191
actionpack-5.2.3/lib/abstract_controller/base.rb:225
def _find_action_name(action_name)
_valid_action_name?(action_name) && method_for_action(action_name)
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:128
actionpack-5.2.3/lib/abstract_controller/base.rb:261
def _valid_action_name?(action_name)
!action_name.to_s.include? File::SEPARATOR
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:226
actionpack-5.2.3/lib/abstract_controller/base.rb:252
def method_for_action(action_name)
if action_method?(action_name)
action_name
elsif respond_to?(:action_missing, true)
"_handle_action_missing"
end
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:226
actionpack-5.2.3/lib/abstract_controller/base.rb:183
def action_method?(name)
self.class.action_methods.include?(name)
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:253
actionpack-5.2.3/lib/abstract_controller/url_for.rb:24
def action_methods
@action_methods ||= begin
if _routes
super - _routes.named_routes.helper_names
else
super
end
end
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:184
activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:19
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:134
activerecord-5.2.3/lib/active_record/log_subscriber.rb:15
def self.reset_runtime
rt, self.runtime = runtime, 0
rt
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:23
activerecord-5.2.3/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:12
activerecord-5.2.3/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:8
actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:243
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:24
actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:286
def _wrapper_enabled?
return false unless request.has_content_type?
ref = request.content_mime_type.ref
_wrapper_formats.include?(ref) && _wrapper_key && !request.parameters.key?(_wrapper_key)
end
# called from actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:244
actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:30
def has_content_type? # :nodoc:
get_header "CONTENT_TYPE"
end
# called from actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:287
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:31
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:19
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:256
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:42
def filtered_parameters
@filtered_parameters ||= parameter_filter.filter(parameters)
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:23
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:58
def parameter_filter # :doc:
parameter_filter_for fetch_header("action_dispatch.parameter_filter") {
return NULL_PARAM_FILTER
}
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:43
rack-2.0.7/lib/rack/request.rb:58
def fetch_header(name, &block)
@env.fetch(name, &block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:59
actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:71
def parameter_filter_for(filters) # :doc:
ParameterFilter.new(filters)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:59
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:10
def initialize(filters = [])
@filters = filters
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:72
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:50
def parameters
params = get_header("action_dispatch.request.parameters")
return params if params
params = begin
request_parameters.merge(query_parameters)
rescue EOFError
query_parameters.dup
end
params.merge!(path_parameters)
params = set_binary_encoding(params, params[:controller], params[:action])
set_header("action_dispatch.request.parameters", params)
params
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:43
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:51
actionpack-5.2.3/lib/action_dispatch/http/request.rb:379
def POST
fetch_header("action_dispatch.request.request_parameters") do
pr = parse_formatted_parameters(params_parsers) do |params|
super || {}
end
self.request_parameters = Request::Utils.normalize_encode_params(pr)
end
rescue Http::Parameters::ParseError # one of the parse strategies blew up
self.request_parameters = Request::Utils.normalize_encode_params(super || {})
raise
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new("Invalid request parameters: #{e.message}")
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:55
rack-2.0.7/lib/rack/request.rb:58
def fetch_header(name, &block)
@env.fetch(name, &block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:380
actionpack-5.2.3/lib/action_dispatch/http/request.rb:366
def GET
fetch_header("action_dispatch.request.query_parameters") do |k|
rack_query_params = super || {}
# Check for non UTF-8 parameter values, which would cause errors later
Request::Utils.check_param_encoding(rack_query_params)
set_header k, Request::Utils.normalize_encode_params(rack_query_params)
end
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new("Invalid query parameters: #{e.message}")
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:55
rack-2.0.7/lib/rack/request.rb:58
def fetch_header(name, &block)
@env.fetch(name, &block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:367
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:83
def path_parameters
get_header(PARAMETERS_KEY) || set_header(PARAMETERS_KEY, {})
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:59
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:84
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:89
def set_binary_encoding(params, controller, action)
return params unless controller && controller.valid_encoding?
if binary_params_for?(controller, action)
ActionDispatch::Request::Utils.each_param_value(params) do |param|
param.force_encoding ::Encoding::ASCII_8BIT
end
end
params
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:60
actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:100
def binary_params_for?(controller, action)
controller_class_for(controller).binary_params_for?(action)
rescue NameError
false
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:92
actionpack-5.2.3/lib/action_dispatch/http/request.rb:84
def controller_class_for(name)
if name
controller_param = name.underscore
const_name = "#{controller_param.camelize}Controller"
ActiveSupport::Dependencies.constantize(const_name)
else
PASS_NOT_FOUND
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:101
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/inflector/inflections.rb:67
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/dependencies.rb:582
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/metal.rb:139
def self.binary_params_for?(action) # :nodoc:
false
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:101
rack-2.0.7/lib/rack/request.rb:68
def set_header(name, v)
@env[name] = v
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameters.rb:61
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:14
def filter(params)
compiled_filter.call(params)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/filter_parameters.rb:43
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:20
def compiled_filter
@compiled_filter ||= CompiledFilter.compile(@filters)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:15
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:25
def self.compile(filters)
return lambda { |params| params.dup } if filters.empty?
strings, regexps, blocks = [], [], []
filters.each do |item|
case item
when Proc
blocks << item
when Regexp
regexps << item
else
strings << Regexp.escape(item.to_s)
end
end
deep_regexps, regexps = regexps.partition { |r| r.to_s.include?("\\.".freeze) }
deep_strings, strings = strings.partition { |s| s.include?("\\.".freeze) }
regexps << Regexp.new(strings.join("|".freeze), true) unless strings.empty?
deep_regexps << Regexp.new(deep_strings.join("|".freeze), true) unless deep_strings.empty?
new regexps, deep_regexps, blocks
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:21
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:52
def initialize(regexps, deep_regexps, blocks)
@regexps = regexps
@deep_regexps = deep_regexps.any? ? deep_regexps : nil
@blocks = blocks
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:47
actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:58
def call(original_params, parents = [])
filtered_params = original_params.class.new
original_params.each do |key, value|
parents.push(key) if deep_regexps
if regexps.any? { |r| key =~ r }
value = FILTERED
elsif deep_regexps && (joined = parents.join(".")) && deep_regexps.any? { |r| joined =~ r }
value = FILTERED
elsif value.is_a?(Hash)
value = call(value, parents)
elsif value.is_a?(Array)
value = value.map { |v| v.is_a?(Hash) ? call(v, parents) : v }
elsif blocks.any?
key = key.dup if key.duplicable?
value = value.dup if value.duplicable?
blocks.each { |b| b.call(key, value) }
end
parents.pop if deep_regexps
filtered_params[key] = value
end
filtered_params
end
# called from actionpack-5.2.3/lib/action_dispatch/http/parameter_filter.rb:15
actionpack-5.2.3/lib/action_dispatch/http/request.rb:199
def headers
@headers ||= Http::Headers.new(self)
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:24
actionpack-5.2.3/lib/action_dispatch/http/headers.rb:54
def initialize(request) # :nodoc:
@req = request
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:200
actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:54
def format(view_path = [])
formats.first || Mime::NullType.instance
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:25
actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:58
def formats
fetch_header("action_dispatch.request.formats") do |k|
params_readable = begin
parameters[:format]
rescue ActionController::BadRequest
false
end
v = if params_readable
Array(Mime[parameters[:format]])
elsif use_accept_header && valid_accept_header
accepts
elsif extension_format = format_from_path_extension
[extension_format]
elsif xhr?
[Mime[:js]]
else
[Mime[:html]]
end
v = v.select do |format|
format.symbol || format.ref == "*/*"
end
set_header k, v
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:55
rack-2.0.7/lib/rack/request.rb:58
def fetch_header(name, &block)
@env.fetch(name, &block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:59
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:244
def ref
symbol || to_s
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:25
actionpack-5.2.3/lib/action_dispatch/http/request.rb:134
def request_method
@request_method ||= check_method(super)
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:26
actionpack-5.2.3/lib/action_dispatch/http/request.rb:238
def fullpath
@fullpath ||= super
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:27
rack-2.0.7/lib/rack/request.rb:407
def fullpath
@fullpath ||= super
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:239
rack-2.0.7/lib/rack/request.rb:136
def query_string; get_header(QUERY_STRING).to_s end
# called from rack-2.0.7/lib/rack/request.rb:408
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:136
rack-2.0.7/lib/rack/request.rb:403
def path
script_name + path_info
end
# called from rack-2.0.7/lib/rack/request.rb:408
rack-2.0.7/lib/rack/request.rb:129
def script_name; get_header(SCRIPT_NAME).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:129
rack-2.0.7/lib/rack/request.rb:132
def path_info; get_header(PATH_INFO).to_s end
# called from rack-2.0.7/lib/rack/request.rb:404
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from rack-2.0.7/lib/rack/request.rb:132
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:80
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:84
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:7
def start_processing(event)
return unless logger.info?
payload = event.payload
params = payload[:params].except(*INTERNAL_PARAMS)
format = payload[:format]
format = format.to_s.upcase if format.is_a?(Symbol)
info "Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info " Parameters: #{params.inspect}" unless params.empty?
end
# called from activesupport-5.2.3/lib/active_support/subscriber.rb:101
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from actionpack-5.2.3/lib/action_controller/log_subscriber.rb:8
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:80
actionpack-5.2.3/lib/action_controller/metal/rescue.rb:21
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:34
actionpack-5.2.3/lib/abstract_controller/callbacks.rb:40
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/rescue.rb:22
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:28
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/abstract_controller/callbacks.rb:42
actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:58
def formats
fetch_header("action_dispatch.request.formats") do |k|
params_readable = begin
parameters[:format]
rescue ActionController::BadRequest
false
end
v = if params_readable
Array(Mime[parameters[:format]])
elsif use_accept_header && valid_accept_header
accepts
elsif extension_format = format_from_path_extension
[extension_format]
elsif xhr?
[Mime[:js]]
else
[Mime[:html]]
end
v = v.select do |format|
format.symbol || format.ref == "*/*"
end
set_header k, v
end
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:29
rack-2.0.7/lib/rack/request.rb:58
def fetch_header(name, &block)
@env.fetch(name, &block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:59
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:244
def ref
symbol || to_s
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:29
actionview-5.2.3/lib/action_view/view_paths.rb:11
delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=,
:locale, :locale=, to: :lookup_context
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:29
actionview-5.2.3/lib/action_view/view_paths.rb:40
def lookup_context
@_lookup_context ||=
ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes)
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:11
actionview-5.2.3/lib/action_view/view_paths.rb:45
def details_for_lookup
{}
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:42
actionview-5.2.3/lib/action_view/view_paths.rb:33
def _prefixes # :nodoc:
self.class._prefixes
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:42
actionview-5.2.3/lib/action_view/view_paths.rb:15
def _prefixes # :nodoc:
@_prefixes ||= begin
return local_prefixes if superclass.abstract?
local_prefixes + superclass._prefixes
end
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:34
actionview-5.2.3/lib/action_view/lookup_context.rb:222
def initialize(view_paths, details = {}, prefixes = [])
@details_key = nil
@cache = true
@prefixes = prefixes
@rendered_format = nil
@details = initialize_details({}, details)
self.view_paths = view_paths
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:42
actionview-5.2.3/lib/action_view/lookup_context.rb:236
def initialize_details(target, details)
registered_details.each do |k|
target[k] = details[k] || Accessors::DEFAULT_PROCS[k].call
end
target
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:228
i18n-1.6.0/lib/i18n.rb:54
def #{method}
config.#{method}
end
def #{method}=(value)
config.#{method} = (value)
end
DELEGATORS
end
# Tells the backend to reload translations. Used in situations like the
# Rails development environment. Backends can implement whatever strategy
# is useful.
def reload!
config.clear_available_locales_set
config.backend.reload!
end
# Tells the backend to load translations now. Used in situations like the
# Rails production environment. Backends can implement whatever strategy
# is useful.
def eager_load!
config.backend.eager_load!
end
# Translates, pluralizes and interpolates a given key using a given locale,
# scope, and default, as well as interpolation values.
#
# *LOOKUP*
#
# Translation data is organized as a nested hash using the upper-level keys
# as namespaces. <em>E.g.</em>, ActionView ships with the translation:
# <tt>:date => {:formats => {:short => "%b %d"}}</tt>.
#
# Translations can be looked up at any level of this hash using the key argument
# and the scope option. <em>E.g.</em>, in this example <tt>I18n.t :date</tt>
# returns the whole translations hash <tt>{:formats => {:short => "%b %d"}}</tt>.
#
# Key can be either a single key or a dot-separated key (both Strings and Symbols
# work). <em>E.g.</em>, the short format can be looked up using both:
# I18n.t 'date.formats.short'
# I18n.t :'date.formats.short'
#
# Scope can be either a single key, a dot-separated key or an array of keys
# or dot-separated keys. Keys and scopes can be combined freely. So these
# examples will all look up the same short date format:
# I18n.t 'date.formats.short'
# I18n.t 'formats.short', :scope => 'date'
# I18n.t 'short', :scope => 'date.formats'
# I18n.t 'short', :scope => %w(date formats)
#
# *INTERPOLATION*
#
# Translations can contain interpolation variables which will be replaced by
# values passed to #translate as part of the options hash, with the keys matching
# the interpolation variable names.
#
# <em>E.g.</em>, with a translation <tt>:foo => "foo %{bar}"</tt> the option
# value for the key +bar+ will be interpolated into the translation:
# I18n.t :foo, :bar => 'baz' # => 'foo baz'
#
# *PLURALIZATION*
#
# Translation data can contain pluralized translations. Pluralized translations
# are arrays of singluar/plural versions of translations like <tt>['Foo', 'Foos']</tt>.
#
# Note that <tt>I18n::Backend::Simple</tt> only supports an algorithm for English
# pluralization rules. Other algorithms can be supported by custom backends.
#
# This returns the singular version of a pluralized translation:
# I18n.t :foo, :count => 1 # => 'Foo'
#
# These both return the plural version of a pluralized translation:
# I18n.t :foo, :count => 0 # => 'Foos'
# I18n.t :foo, :count => 2 # => 'Foos'
#
# The <tt>:count</tt> option can be used both for pluralization and interpolation.
# <em>E.g.</em>, with the translation
# <tt>:foo => ['%{count} foo', '%{count} foos']</tt>, count will
# be interpolated to the pluralized translation:
# I18n.t :foo, :count => 1 # => '1 foo'
#
# *DEFAULTS*
#
# This returns the translation for <tt>:foo</tt> or <tt>default</tt> if no translation was found:
# I18n.t :foo, :default => 'default'
#
# This returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt> if no
# translation for <tt>:foo</tt> was found:
# I18n.t :foo, :default => :bar
#
# Returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt>
# or <tt>default</tt> if no translations for <tt>:foo</tt> and <tt>:bar</tt> were found.
# I18n.t :foo, :default => [:bar, 'default']
#
# *BULK LOOKUP*
#
# This returns an array with the translations for <tt>:foo</tt> and <tt>:bar</tt>.
# I18n.t [:foo, :bar]
#
# Can be used with dot-separated nested keys:
# I18n.t [:'baz.foo', :'baz.bar']
#
# Which is the same as using a scope option:
# I18n.t [:foo, :bar], :scope => :baz
#
# *LAMBDAS*
#
# Both translations and defaults can be given as Ruby lambdas. Lambdas will be
# called and passed the key and options.
#
# E.g. assuming the key <tt>:salutation</tt> resolves to:
# lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
#
# Then <tt>I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
#
# Note that the string returned by lambda will go through string interpolation too,
# so the following lambda would give the same result:
# lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
#
# It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
# a cache layer is put in front of I18n.translate it will generate a cache key
# from the argument values passed to #translate. Therefor your lambdas should
# always return the same translations/values per unique combination of argument
# values.
def translate(key = nil, *, throw: false, raise: false, locale: nil, **options) # TODO deprecate :raise
locale ||= config.locale
raise Disabled.new('t') if locale == false
enforce_available_locales!(locale)
backend = config.backend
result = catch(:exception) do
if key.is_a?(Array)
key.map { |k| backend.translate(locale, k, options) }
else
backend.translate(locale, key, options)
end
end
if result.is_a?(MissingTranslation)
handle_exception((throw && :throw || raise && :raise), result, locale, key, options)
else
result
end
end
alias :t :translate
# Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With
# this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt>
def translate!(key, options = EMPTY_HASH)
translate(key, options.merge(:raise => true))
end
alias :t! :translate!
# Returns true if a translation exists for a given key, otherwise returns false.
def exists?(key, _locale = nil, locale: _locale)
locale ||= config.locale
raise Disabled.new('exists?') if locale == false
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
config.backend.exists?(locale, key)
end
# Transliterates UTF-8 characters to ASCII. By default this method will
# transliterate only Latin strings to an ASCII approximation:
#
# I18n.transliterate("Ærøskøbing")
# # => "AEroskobing"
#
# I18n.transliterate("日本語")
# # => "???"
#
# It's also possible to add support for per-locale transliterations. I18n
# expects transliteration rules to be stored at
# <tt>i18n.transliterate.rule</tt>.
#
# Transliteration rules can either be a Hash or a Proc. Procs must accept a
# single string argument. Hash rules inherit the default transliteration
# rules, while Procs do not.
#
# *Examples*
#
# Setting a Hash in <locale>.yml:
#
# i18n:
# transliterate:
# rule:
# ü: "ue"
# ö: "oe"
#
# Setting a Hash using Ruby:
#
# store_translations(:de, :i18n => {
# :transliterate => {
# :rule => {
# "ü" => "ue",
# "ö" => "oe"
# }
# }
# )
#
# Setting a Proc:
#
# translit = lambda {|string| MyTransliterator.transliterate(string) }
# store_translations(:xx, :i18n => {:transliterate => {:rule => translit})
#
# Transliterating strings:
#
# I18n.locale = :en
# I18n.transliterate("Jürgen") # => "Jurgen"
# I18n.locale = :de
# I18n.transliterate("Jürgen") # => "Juergen"
# I18n.transliterate("Jürgen", :locale => :en) # => "Jurgen"
# I18n.transliterate("Jürgen", :locale => :de) # => "Juergen"
def transliterate(key, *, throw: false, raise: false, locale: nil, replacement: nil, **options)
locale ||= config.locale
raise Disabled.new('transliterate') if locale == false
enforce_available_locales!(locale)
config.backend.transliterate(locale, key, replacement)
rescue I18n::ArgumentError => exception
handle_exception((throw && :throw || raise && :raise), exception, locale, key, options)
end
# Localizes certain objects, such as dates and numbers to local formatting.
def localize(object, locale: nil, format: nil, **options)
locale ||= config.locale
raise Disabled.new('l') if locale == false
enforce_available_locales!(locale)
format ||= :default
config.backend.localize(locale, object, format, options)
end
alias :l :localize
# Executes block with given I18n.locale set.
def with_locale(tmp_locale = nil)
if tmp_locale == nil
yield
else
current_locale = self.locale
self.locale = tmp_locale
begin
yield
ensure
self.locale = current_locale
end
end
end
# Merges the given locale, key and scope into a single array of keys.
# Splits keys that contain dots into multiple keys. Makes sure all
# keys are Symbols.
def normalize_keys(locale, key, scope, separator = nil)
separator ||= I18n.default_separator
keys = []
keys.concat normalize_key(locale, separator)
keys.concat normalize_key(scope, separator)
keys.concat normalize_key(key, separator)
keys
end
# Returns true when the passed locale, which can be either a String or a
# Symbol, is in the list of available locales. Returns false otherwise.
def locale_available?(locale)
I18n.config.available_locales_set.include?(locale)
end
# Raises an InvalidLocale exception when the passed locale is not available.
def enforce_available_locales!(locale)
if locale != false && config.enforce_available_locales
raise I18n::InvalidLocale.new(locale) if !locale_available?(locale)
end
end
def available_locales_initialized?
config.available_locales_initialized?
end
private
# Any exceptions thrown in translate will be sent to the @@exception_handler
# which can be a Symbol, a Proc or any other Object unless they're forced to
# be raised or thrown (MissingTranslation).
#
# If exception_handler is a Symbol then it will simply be sent to I18n as
# a method call. A Proc will simply be called. In any other case the
# method #call will be called on the exception_handler object.
#
# Examples:
#
# I18n.exception_handler = :custom_exception_handler # this is the default
# I18n.custom_exception_handler(exception, locale, key, options) # will be called like this
#
# I18n.exception_handler = lambda { |*args| ... } # a lambda
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
#
# I18n.exception_handler = I18nExceptionHandler.new # an object
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
def handle_exception(handling, exception, locale, key, options)
case handling
when :raise
raise exception.respond_to?(:to_exception) ? exception.to_exception : exception
when :throw
throw :exception, exception
else
case handler = options[:exception_handler] || config.exception_handler
when Symbol
send(handler, exception, locale, key, options)
else
handler.call(exception, locale, key, options)
end
end
end
@@normalized_key_cache = I18n.new_double_nested_cache
def normalize_key(key, separator)
@@normalized_key_cache[separator][key] ||=
case key
when Array
key.map { |k| normalize_key(k, separator) }.flatten
else
keys = key.to_s.split(separator)
keys.delete('')
keys.map! do |k|
case k
when /\A[-+]?[1-9]\d*\z/ # integer
k.to_i
when 'true'
true
when 'false'
false
else
k.to_sym
end
end
keys
end
end
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:46
i18n-1.6.0/lib/i18n.rb:41
def config
Thread.current[:i18n_config] ||= I18n::Config.new
end
# called from i18n-1.6.0/lib/i18n.rb:55
i18n-1.6.0/lib/i18n/config.rb:9
def locale
defined?(@locale) && @locale != nil ? @locale : default_locale
end
# called from i18n-1.6.0/lib/i18n.rb:55
i18n-1.6.0/lib/i18n/config.rb:30
def default_locale
@@default_locale ||= :en
end
# called from i18n-1.6.0/lib/i18n/config.rb:10
i18n-1.6.0/lib/i18n.rb:54
def #{method}
config.#{method}
end
def #{method}=(value)
config.#{method} = (value)
end
DELEGATORS
end
# Tells the backend to reload translations. Used in situations like the
# Rails development environment. Backends can implement whatever strategy
# is useful.
def reload!
config.clear_available_locales_set
config.backend.reload!
end
# Tells the backend to load translations now. Used in situations like the
# Rails production environment. Backends can implement whatever strategy
# is useful.
def eager_load!
config.backend.eager_load!
end
# Translates, pluralizes and interpolates a given key using a given locale,
# scope, and default, as well as interpolation values.
#
# *LOOKUP*
#
# Translation data is organized as a nested hash using the upper-level keys
# as namespaces. <em>E.g.</em>, ActionView ships with the translation:
# <tt>:date => {:formats => {:short => "%b %d"}}</tt>.
#
# Translations can be looked up at any level of this hash using the key argument
# and the scope option. <em>E.g.</em>, in this example <tt>I18n.t :date</tt>
# returns the whole translations hash <tt>{:formats => {:short => "%b %d"}}</tt>.
#
# Key can be either a single key or a dot-separated key (both Strings and Symbols
# work). <em>E.g.</em>, the short format can be looked up using both:
# I18n.t 'date.formats.short'
# I18n.t :'date.formats.short'
#
# Scope can be either a single key, a dot-separated key or an array of keys
# or dot-separated keys. Keys and scopes can be combined freely. So these
# examples will all look up the same short date format:
# I18n.t 'date.formats.short'
# I18n.t 'formats.short', :scope => 'date'
# I18n.t 'short', :scope => 'date.formats'
# I18n.t 'short', :scope => %w(date formats)
#
# *INTERPOLATION*
#
# Translations can contain interpolation variables which will be replaced by
# values passed to #translate as part of the options hash, with the keys matching
# the interpolation variable names.
#
# <em>E.g.</em>, with a translation <tt>:foo => "foo %{bar}"</tt> the option
# value for the key +bar+ will be interpolated into the translation:
# I18n.t :foo, :bar => 'baz' # => 'foo baz'
#
# *PLURALIZATION*
#
# Translation data can contain pluralized translations. Pluralized translations
# are arrays of singluar/plural versions of translations like <tt>['Foo', 'Foos']</tt>.
#
# Note that <tt>I18n::Backend::Simple</tt> only supports an algorithm for English
# pluralization rules. Other algorithms can be supported by custom backends.
#
# This returns the singular version of a pluralized translation:
# I18n.t :foo, :count => 1 # => 'Foo'
#
# These both return the plural version of a pluralized translation:
# I18n.t :foo, :count => 0 # => 'Foos'
# I18n.t :foo, :count => 2 # => 'Foos'
#
# The <tt>:count</tt> option can be used both for pluralization and interpolation.
# <em>E.g.</em>, with the translation
# <tt>:foo => ['%{count} foo', '%{count} foos']</tt>, count will
# be interpolated to the pluralized translation:
# I18n.t :foo, :count => 1 # => '1 foo'
#
# *DEFAULTS*
#
# This returns the translation for <tt>:foo</tt> or <tt>default</tt> if no translation was found:
# I18n.t :foo, :default => 'default'
#
# This returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt> if no
# translation for <tt>:foo</tt> was found:
# I18n.t :foo, :default => :bar
#
# Returns the translation for <tt>:foo</tt> or the translation for <tt>:bar</tt>
# or <tt>default</tt> if no translations for <tt>:foo</tt> and <tt>:bar</tt> were found.
# I18n.t :foo, :default => [:bar, 'default']
#
# *BULK LOOKUP*
#
# This returns an array with the translations for <tt>:foo</tt> and <tt>:bar</tt>.
# I18n.t [:foo, :bar]
#
# Can be used with dot-separated nested keys:
# I18n.t [:'baz.foo', :'baz.bar']
#
# Which is the same as using a scope option:
# I18n.t [:foo, :bar], :scope => :baz
#
# *LAMBDAS*
#
# Both translations and defaults can be given as Ruby lambdas. Lambdas will be
# called and passed the key and options.
#
# E.g. assuming the key <tt>:salutation</tt> resolves to:
# lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
#
# Then <tt>I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
#
# Note that the string returned by lambda will go through string interpolation too,
# so the following lambda would give the same result:
# lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
#
# It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
# a cache layer is put in front of I18n.translate it will generate a cache key
# from the argument values passed to #translate. Therefor your lambdas should
# always return the same translations/values per unique combination of argument
# values.
def translate(key = nil, *, throw: false, raise: false, locale: nil, **options) # TODO deprecate :raise
locale ||= config.locale
raise Disabled.new('t') if locale == false
enforce_available_locales!(locale)
backend = config.backend
result = catch(:exception) do
if key.is_a?(Array)
key.map { |k| backend.translate(locale, k, options) }
else
backend.translate(locale, key, options)
end
end
if result.is_a?(MissingTranslation)
handle_exception((throw && :throw || raise && :raise), result, locale, key, options)
else
result
end
end
alias :t :translate
# Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With
# this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt>
def translate!(key, options = EMPTY_HASH)
translate(key, options.merge(:raise => true))
end
alias :t! :translate!
# Returns true if a translation exists for a given key, otherwise returns false.
def exists?(key, _locale = nil, locale: _locale)
locale ||= config.locale
raise Disabled.new('exists?') if locale == false
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
config.backend.exists?(locale, key)
end
# Transliterates UTF-8 characters to ASCII. By default this method will
# transliterate only Latin strings to an ASCII approximation:
#
# I18n.transliterate("Ærøskøbing")
# # => "AEroskobing"
#
# I18n.transliterate("日本語")
# # => "???"
#
# It's also possible to add support for per-locale transliterations. I18n
# expects transliteration rules to be stored at
# <tt>i18n.transliterate.rule</tt>.
#
# Transliteration rules can either be a Hash or a Proc. Procs must accept a
# single string argument. Hash rules inherit the default transliteration
# rules, while Procs do not.
#
# *Examples*
#
# Setting a Hash in <locale>.yml:
#
# i18n:
# transliterate:
# rule:
# ü: "ue"
# ö: "oe"
#
# Setting a Hash using Ruby:
#
# store_translations(:de, :i18n => {
# :transliterate => {
# :rule => {
# "ü" => "ue",
# "ö" => "oe"
# }
# }
# )
#
# Setting a Proc:
#
# translit = lambda {|string| MyTransliterator.transliterate(string) }
# store_translations(:xx, :i18n => {:transliterate => {:rule => translit})
#
# Transliterating strings:
#
# I18n.locale = :en
# I18n.transliterate("Jürgen") # => "Jurgen"
# I18n.locale = :de
# I18n.transliterate("Jürgen") # => "Juergen"
# I18n.transliterate("Jürgen", :locale => :en) # => "Jurgen"
# I18n.transliterate("Jürgen", :locale => :de) # => "Juergen"
def transliterate(key, *, throw: false, raise: false, locale: nil, replacement: nil, **options)
locale ||= config.locale
raise Disabled.new('transliterate') if locale == false
enforce_available_locales!(locale)
config.backend.transliterate(locale, key, replacement)
rescue I18n::ArgumentError => exception
handle_exception((throw && :throw || raise && :raise), exception, locale, key, options)
end
# Localizes certain objects, such as dates and numbers to local formatting.
def localize(object, locale: nil, format: nil, **options)
locale ||= config.locale
raise Disabled.new('l') if locale == false
enforce_available_locales!(locale)
format ||= :default
config.backend.localize(locale, object, format, options)
end
alias :l :localize
# Executes block with given I18n.locale set.
def with_locale(tmp_locale = nil)
if tmp_locale == nil
yield
else
current_locale = self.locale
self.locale = tmp_locale
begin
yield
ensure
self.locale = current_locale
end
end
end
# Merges the given locale, key and scope into a single array of keys.
# Splits keys that contain dots into multiple keys. Makes sure all
# keys are Symbols.
def normalize_keys(locale, key, scope, separator = nil)
separator ||= I18n.default_separator
keys = []
keys.concat normalize_key(locale, separator)
keys.concat normalize_key(scope, separator)
keys.concat normalize_key(key, separator)
keys
end
# Returns true when the passed locale, which can be either a String or a
# Symbol, is in the list of available locales. Returns false otherwise.
def locale_available?(locale)
I18n.config.available_locales_set.include?(locale)
end
# Raises an InvalidLocale exception when the passed locale is not available.
def enforce_available_locales!(locale)
if locale != false && config.enforce_available_locales
raise I18n::InvalidLocale.new(locale) if !locale_available?(locale)
end
end
def available_locales_initialized?
config.available_locales_initialized?
end
private
# Any exceptions thrown in translate will be sent to the @@exception_handler
# which can be a Symbol, a Proc or any other Object unless they're forced to
# be raised or thrown (MissingTranslation).
#
# If exception_handler is a Symbol then it will simply be sent to I18n as
# a method call. A Proc will simply be called. In any other case the
# method #call will be called on the exception_handler object.
#
# Examples:
#
# I18n.exception_handler = :custom_exception_handler # this is the default
# I18n.custom_exception_handler(exception, locale, key, options) # will be called like this
#
# I18n.exception_handler = lambda { |*args| ... } # a lambda
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
#
# I18n.exception_handler = I18nExceptionHandler.new # an object
# I18n.exception_handler.call(exception, locale, key, options) # will be called like this
def handle_exception(handling, exception, locale, key, options)
case handling
when :raise
raise exception.respond_to?(:to_exception) ? exception.to_exception : exception
when :throw
throw :exception, exception
else
case handler = options[:exception_handler] || config.exception_handler
when Symbol
send(handler, exception, locale, key, options)
else
handler.call(exception, locale, key, options)
end
end
end
@@normalized_key_cache = I18n.new_double_nested_cache
def normalize_key(key, separator)
@@normalized_key_cache[separator][key] ||=
case key
when Array
key.map { |k| normalize_key(k, separator) }.flatten
else
keys = key.to_s.split(separator)
keys.delete('')
keys.map! do |k|
case k
when /\A[-+]?[1-9]\d*\z/ # integer
k.to_i
when 'true'
true
when 'false'
false
else
k.to_sym
end
end
keys
end
end
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:48
i18n-1.6.0/lib/i18n.rb:41
def config
Thread.current[:i18n_config] ||= I18n::Config.new
end
# called from i18n-1.6.0/lib/i18n.rb:55
i18n-1.6.0/lib/i18n/config.rb:30
def default_locale
@@default_locale ||= :en
end
# called from i18n-1.6.0/lib/i18n.rb:55
actionview-5.2.3/lib/action_view/template/handlers.rb:23
def self.extensions
@@template_extensions ||= @@template_handlers.keys
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:54
actionview-5.2.3/lib/action_view/lookup_context.rb:111
def view_paths=(paths)
@view_paths = ActionView::PathSet.new(Array(paths))
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:229
actionview-5.2.3/lib/action_view/path_set.rb:27
def to_ary
paths.dup
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:112
actionview-5.2.3/lib/action_view/path_set.rb:18
def initialize(paths = [])
@paths = typecast paths
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:112
actionview-5.2.3/lib/action_view/path_set.rb:89
def typecast(paths)
paths.map do |path|
case path
when Pathname, String
OptimizedFileSystemResolver.new path.to_s
else
path
end
end
end
# called from actionview-5.2.3/lib/action_view/path_set.rb:19
actionview-5.2.3/lib/action_view/lookup_context.rb:246
def formats=(values)
if values
values.concat(default_formats) if values.delete "*/*".freeze
if values == [:js]
values << :html
@html_fallback_for_js = true
end
end
super(values)
end
# called from actionview-5.2.3/lib/action_view/view_paths.rb:11
actionview-5.2.3/lib/action_view/lookup_context.rb:33
def formats=(values)
if values
values.concat(default_formats) if values.delete "*/*".freeze
if values == [:js]
values << :html
@html_fallback_for_js = true
end
end
super(values)
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:254
actionview-5.2.3/lib/action_view/lookup_context.rb:98
def _set_detail(key, value) # :doc:
@details = @details.dup if @details_key
@details_key = nil
@details[key] = value
end
# called from actionview-5.2.3/lib/action_view/lookup_context.rb:35
actionpack-5.2.3/lib/abstract_controller/base.rb:193
def process_action(action, *args)
# We also need to reset the runtime before each action
# because of queries in middleware or in cases we are streaming
# and it won't be cleaned up by the method below.
ActiveRecord::LogSubscriber.reset_runtime
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:30
actionpack-5.2.3/lib/action_controller/metal/basic_implicit_render.rb:5
def send_action(method, *args)
super.tap { default_render unless performed? }
end
# called from actionpack-5.2.3/lib/abstract_controller/base.rb:194
/Users/yhirano/dev/src/github.com/yhirano55/testcode_app/app/controllers/books_controller.rb:5
def index
@books = Book.all
render json: @books
end
# called from actionpack-5.2.3/lib/action_controller/metal/basic_implicit_render.rb:6
activerecord-5.2.3/lib/active_record/scoping/named.rb:26
def all
current_scope = self.current_scope
if current_scope
if self == current_scope.klass
current_scope.clone
else
relation.merge!(current_scope)
end
else
default_scoped
end
end
# called from /Users/yhirano/dev/src/github.com/yhirano55/testcode_app/app/controllers/books_controller.rb:6
activerecord-5.2.3/lib/active_record/scoping.rb:15
def current_scope(skip_inherited_scope = false)
ScopeRegistry.value_for(:current_scope, self, skip_inherited_scope)
end
# called from activerecord-5.2.3/lib/active_record/scoping/named.rb:27
activerecord-5.2.3/lib/active_record/scoping.rb:79
def value_for(scope_type, model, skip_inherited_scope = false)
raise_invalid_scope_type!(scope_type)
return @registry[scope_type][model.name] if skip_inherited_scope
klass = model
base = model.base_class
while klass <= base
value = @registry[scope_type][klass.name]
return value if value
klass = klass.superclass
end
end
# called from activesupport-5.2.3/lib/active_support/per_thread_registry.rb:55
activerecord-5.2.3/lib/active_record/scoping.rb:99
def raise_invalid_scope_type!(scope_type)
if !VALID_SCOPE_TYPES.include?(scope_type)
raise ArgumentError, "Invalid scope type '#{scope_type}' sent to the registry. Scope types must be included in VALID_SCOPE_TYPES"
end
end
# called from activerecord-5.2.3/lib/active_record/scoping.rb:80
activerecord-5.2.3/lib/active_record/inheritance.rb:95
def base_class
unless self < Base
raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
end
if superclass == Base || superclass.abstract_class?
self
else
superclass.base_class
end
end
# called from activerecord-5.2.3/lib/active_record/scoping.rb:83
activerecord-5.2.3/lib/active_record/inheritance.rb:151
def abstract_class?
defined?(@abstract_class) && @abstract_class == true
end
# called from activerecord-5.2.3/lib/active_record/inheritance.rb:100
activerecord-5.2.3/lib/active_record/core.rb:284
def relation
relation = Relation.create(self)
if finder_needs_type_condition? && !ignore_default_scope?
relation.where!(type_condition)
relation.create_with!(inheritance_column.to_s => sti_name)
else
relation
end
end
# called from activerecord-5.2.3/lib/active_record/scoping/named.rb:50
activerecord-5.2.3/lib/active_record/relation/delegation.rb:131
def create(klass, *args)
relation_class_for(klass).new(klass, *args)
end
# called from activerecord-5.2.3/lib/active_record/core.rb:285
activerecord-5.2.3/lib/active_record/relation/delegation.rb:137
def relation_class_for(klass)
klass.relation_delegate_class(self)
end
# called from activerecord-5.2.3/lib/active_record/relation/delegation.rb:132
activerecord-5.2.3/lib/active_record/relation/delegation.rb:6
def relation_delegate_class(klass)
@relation_delegate_cache[klass]
end
# called from activerecord-5.2.3/lib/active_record/relation/delegation.rb:138
activerecord-5.2.3/lib/active_record/core.rb:260
def arel_table # :nodoc:
@arel_table ||= Arel::Table.new(table_name, type_caster: type_caster)
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:25
activerecord-5.2.3/lib/active_record/core.rb:269
def predicate_builder # :nodoc:
@predicate_builder ||= PredicateBuilder.new(table_metadata)
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:25
activerecord-5.2.3/lib/active_record/relation.rb:25
def initialize(klass, table: klass.arel_table, predicate_builder: klass.predicate_builder, values: {})
@klass = klass
@table = table
@values = values
@offsets = {}
@loaded = false
@predicate_builder = predicate_builder
@delegate_to_klass = false
end
# called from activerecord-5.2.3/lib/active_record/relation/delegation.rb:132
activerecord-5.2.3/lib/active_record/inheritance.rb:82
def finder_needs_type_condition? #:nodoc:
# This is like this because benchmarking justifies the strange :false stuff
:true == (@finder_needs_type_condition ||= descends_from_active_record? ? :false : :true)
end
# called from activerecord-5.2.3/lib/active_record/core.rb:287
activerecord-5.2.3/lib/active_record/scoping/named.rb:50
def default_scoped(scope = relation) # :nodoc:
build_default_scope(scope) || scope
end
# called from activerecord-5.2.3/lib/active_record/scoping/named.rb:36
activerecord-5.2.3/lib/active_record/scoping/default.rb:103
def build_default_scope(base_rel = nil)
return if abstract_class?
if default_scope_override.nil?
self.default_scope_override = !Base.is_a?(method(:default_scope).owner)
end
if default_scope_override
# The user has defined their own default scope method, so call that
evaluate_default_scope do
if scope = default_scope
(base_rel ||= relation).merge!(scope)
end
end
elsif default_scopes.any?
base_rel ||= relation
evaluate_default_scope do
default_scopes.inject(base_rel) do |default_scope, scope|
scope = scope.respond_to?(:to_proc) ? scope : scope.method(:call)
default_scope.merge!(base_rel.instance_exec(&scope))
end
end
end
end
# called from activerecord-5.2.3/lib/active_record/scoping/named.rb:51
activerecord-5.2.3/lib/active_record/inheritance.rb:151
def abstract_class?
defined?(@abstract_class) && @abstract_class == true
end
# called from activerecord-5.2.3/lib/active_record/scoping/default.rb:104
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:43
def render(*args)
render_output = nil
self.view_runtime = cleanup_view_runtime do
Benchmark.ms { render_output = super }
end
render_output
end
# called from /Users/yhirano/dev/src/github.com/yhirano55/testcode_app/app/controllers/books_controller.rb:8
activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:27
def cleanup_view_runtime
if logger && logger.info? && ActiveRecord::Base.connected?
db_rt_before_render = ActiveRecord::LogSubscriber.reset_runtime
self.db_runtime = (db_runtime || 0) + db_rt_before_render
runtime = super
db_rt_after_render = ActiveRecord::LogSubscriber.reset_runtime
self.db_runtime += db_rt_after_render
runtime - db_rt_after_render
else
super
end
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:45
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/connection_handling.rb:122
def connected?
connection_handler.connected?(connection_specification_name)
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:28
activerecord-5.2.3/lib/active_record/core.rb:130
def self.connection_handler
ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/core.rb:131
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1019
def connected?(spec_name)
conn = retrieve_connection_pool(spec_name)
conn && conn.connected?
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1039
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
# Check if a connection was previously established in an ancestor process,
# which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
establish_connection(ancestor_pool.spec.to_hash).tap do |pool|
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
end
else
owner_to_pool[spec_name] = nil
end
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1020
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058
def owner_to_pool
@owner_to_pool[Process.pid]
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1059
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:168
def fetch(key, default_value = NULL)
if NULL != (value = get_or_default(key, NULL))
value
elsif block_given?
yield key
elsif NULL != default_value
default_value
else
raise_fetch_no_key
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:169
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422
def connected?
synchronize { @connections.any? }
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1021
activerecord-5.2.3/lib/active_record/log_subscriber.rb:15
def self.reset_runtime
rt, self.runtime = runtime, 0
rt
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:29
activerecord-5.2.3/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:12
activerecord-5.2.3/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:8
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:86
def cleanup_view_runtime
if logger && logger.info? && ActiveRecord::Base.connected?
db_rt_before_render = ActiveRecord::LogSubscriber.reset_runtime
self.db_runtime = (db_runtime || 0) + db_rt_before_render
runtime = super
db_rt_after_render = ActiveRecord::LogSubscriber.reset_runtime
self.db_runtime += db_rt_after_render
runtime - db_rt_after_render
else
super
end
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:31
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:34
def render(*args)
render_output = nil
self.view_runtime = cleanup_view_runtime do
Benchmark.ms { render_output = super }
end
render_output
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:46
actionpack-5.2.3/lib/abstract_controller/rendering.rb:23
def render(*args)
render_output = nil
self.view_runtime = cleanup_view_runtime do
Benchmark.ms { render_output = super }
end
render_output
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:36
actionpack-5.2.3/lib/abstract_controller/rendering.rb:116
def _normalize_render(*args, &block) # :nodoc:
options = _normalize_args(*args, &block)
_process_variant(options)
_normalize_options(options)
options
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:24
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:82
def _normalize_args(action = nil, options = {}, &blk)
options = super
options[:update] = blk if block_given?
options
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:117
actionpack-5.2.3/lib/abstract_controller/rendering.rb:78
def _normalize_args(action = nil, options = {}, &blk)
options = super
options[:update] = blk if block_given?
options
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:83
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:57
def _process_variant(options)
if defined?(request) && !request.nil? && request.variant.present?
options[:variant] = request.variant
end
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:118
actionpack-5.2.3/lib/action_dispatch/http/mime_negotiation.rb:100
def variant
@variant ||= ActiveSupport::ArrayInquirer.new
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:58
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:89
def _normalize_options(options)
_normalize_text(options)
if options[:html]
options[:html] = ERB::Util.html_escape(options[:html])
end
if options[:status]
options[:status] = Rack::Utils.status_code(options[:status])
end
super
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:119
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:103
def _normalize_text(options)
RENDER_FORMATS_IN_PRIORITY.each do |format|
if options.key?(format) && options[format].respond_to?(:to_text)
options[format] = options[format].to_text
end
end
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:90
actionpack-5.2.3/lib/abstract_controller/rendering.rb:93
def _normalize_options(options)
_normalize_text(options)
if options[:html]
options[:html] = ERB::Util.html_escape(options[:html])
end
if options[:status]
options[:status] = Rack::Utils.status_code(options[:status])
end
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:100
actionpack-5.2.3/lib/action_controller/metal/renderers.rb:141
def render_to_body(options)
_render_to_body_with_renderer(options) || super
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:25
actionpack-5.2.3/lib/action_controller/metal/renderers.rb:145
def _render_to_body_with_renderer(options)
_renderers.each do |name|
if options.key?(name)
_process_options(options)
method_name = Renderers._render_with_renderer_method_name(name)
return send(method_name, options.delete(name), options)
end
end
nil
end
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:142
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:112
def _process_options(options)
status, content_type, location = options.values_at(:status, :content_type, :location)
self.status = status if status
self.content_type = content_type if content_type
headers["Location"] = url_for(location) if location
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:148
actionpack-5.2.3/lib/abstract_controller/rendering.rb:98
def _process_options(options)
status, content_type, location = options.values_at(:status, :content_type, :location)
self.status = status if status
self.content_type = content_type if content_type
headers["Location"] = url_for(location) if location
super
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:119
actionpack-5.2.3/lib/action_controller/metal/renderers.rb:91
def self._render_with_renderer_method_name(key)
"_render_with_renderer_#{key}"
end
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:149
actionpack-5.2.3/lib/action_controller/metal/renderers.rb:156
add :json do |json, options|
json = json.to_json(options) unless json.kind_of?(String)
if options[:callback].present?
if content_type.nil? || content_type == Mime[:json]
self.content_type = Mime[:js]
end
"/**/#{options[:callback]}(#{json})"
else
self.content_type ||= Mime[:json]
json
end
end
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:150
activerecord-5.2.3/lib/active_record/relation/delegation.rb:71
delegate :to_xml, :encode_with, :length, :each, :uniq, :join,
:[], :&, :|, :+, :-, :sample, :reverse, :rotate, :compact, :in_groups, :in_groups_of,
:to_sentence, :to_formatted_s, :as_json,
:shuffle, :split, :slice, :index, :rindex, to: :records
# called from activesupport-5.2.3/lib/active_support/json/encoding.rb:35
activerecord-5.2.3/lib/active_record/relation.rb:199
def records # :nodoc:
load
@records
end
# called from activerecord-5.2.3/lib/active_record/relation/delegation.rb:71
activerecord-5.2.3/lib/active_record/relation.rb:421
def load(&block)
exec_queries(&block) unless loaded?
self
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:200
activerecord-5.2.3/lib/active_record/relation.rb:546
def exec_queries(&block)
skip_query_cache_if_necessary do
@records =
if eager_loading?
apply_join_dependency do |relation, join_dependency|
if ActiveRecord::NullRelation === relation
[]
else
relation = join_dependency.apply_column_aliases(relation)
rows = connection.select_all(relation.arel, "SQL")
join_dependency.instantiate(rows, &block)
end.freeze
end
else
klass.find_by_sql(arel, &block).freeze
end
preload = preload_values
preload += includes_values unless eager_loading?
preloader = nil
preload.each do |associations|
preloader ||= build_preloader
preloader.preload @records, associations
end
@records.each(&:readonly!) if readonly_value
@loaded = true
@records
end
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:422
activerecord-5.2.3/lib/active_record/relation.rb:578
def skip_query_cache_if_necessary
if skip_query_cache_value
uncached do
yield
end
else
yield
end
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:547
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:579
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation.rb:472
def eager_loading?
@should_eager_load ||=
eager_load_values.any? ||
includes_values.any? && (joined_includes_values.any? || references_eager_loaded_tables?)
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:549
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:474
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:475
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:902
def arel(aliases = nil) # :nodoc:
@arel ||= build_arel(aliases)
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:560
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:926
def build_arel(aliases)
arel = Arel::SelectManager.new(table)
aliases = build_joins(arel, joins_values.flatten, aliases) unless joins_values.empty?
build_left_outer_joins(arel, left_outer_joins_values.flatten, aliases) unless left_outer_joins_values.empty?
arel.where(where_clause.ast) unless where_clause.empty?
arel.having(having_clause.ast) unless having_clause.empty?
if limit_value
limit_attribute = ActiveModel::Attribute.with_cast_value(
"LIMIT".freeze,
connection.sanitize_limit(limit_value),
Type.default_value,
)
arel.take(Arel::Nodes::BindParam.new(limit_attribute))
end
if offset_value
offset_attribute = ActiveModel::Attribute.with_cast_value(
"OFFSET".freeze,
offset_value.to_i,
Type.default_value,
)
arel.skip(Arel::Nodes::BindParam.new(offset_attribute))
end
arel.group(*arel_columns(group_values.uniq.reject(&:blank?))) unless group_values.empty?
build_order(arel)
build_select(arel)
arel.distinct(distinct_value)
arel.from(build_from) unless from_clause.empty?
arel.lock(lock_value) if lock_value
arel
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:903
arel-9.0.0/lib/arel/select_manager.rb:10
def initialize table = nil
super()
@ast = Nodes::SelectStatement.new
@ctx = @ast.cores.last
from table
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:927
arel-9.0.0/lib/arel/tree_manager.rb:10
def initialize table = nil
super()
@ast = Nodes::SelectStatement.new
@ctx = @ast.cores.last
from table
end
# called from arel-9.0.0/lib/arel/select_manager.rb:11
arel-9.0.0/lib/arel/nodes/select_core.rb:8
def initialize
super()
@source = JoinSource.new nil
@top = nil
# http://savage.net.au/SQL/sql-92.bnf.html#set%20quantifier
@set_quantifier = nil
@projections = []
@wheres = []
@groups = []
@havings = []
@windows = []
end
# called from arel-9.0.0/lib/arel/nodes/select_statement.rb:8
arel-9.0.0/lib/arel/nodes/join_source.rb:10
def initialize single_source, joinop = []
super
end
# called from arel-9.0.0/lib/arel/nodes/select_core.rb:10
arel-9.0.0/lib/arel/nodes/binary.rb:7
def initialize single_source, joinop = []
super
end
# called from arel-9.0.0/lib/arel/nodes/join_source.rb:11
arel-9.0.0/lib/arel/nodes/select_statement.rb:8
def initialize cores = [SelectCore.new]
super()
@cores = cores
@orders = []
@limit = nil
@lock = nil
@offset = nil
@with = nil
end
# called from arel-9.0.0/lib/arel/select_manager.rb:12
arel-9.0.0/lib/arel/select_manager.rb:88
def from table
table = Nodes::SqlLiteral.new(table) if String === table
case table
when Nodes::Join
@ctx.source.right << table
else
@ctx.source.left = table
end
self
end
# called from arel-9.0.0/lib/arel/select_manager.rb:14
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:929
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:930
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:932
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/where_clause.rb:6
delegate :any?, :empty?, to: :predicates
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:932
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:933
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/where_clause.rb:6
delegate :any?, :empty?, to: :predicates
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:933
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:934
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:942
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:950
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1121
def build_order(arel)
orders = order_values.uniq
orders.reject!(&:blank?)
arel.order(*orders) unless orders.empty?
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:952
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1122
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1042
def build_select(arel)
if select_values.any?
arel.project(*arel_columns(select_values.uniq))
elsif klass.ignored_columns.any?
arel.project(*klass.column_names.map { |field| arel_attribute(field) })
else
arel.project(table[Arel.star])
end
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:954
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1043
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/model_schema.rb:264
def ignored_columns
if defined?(@ignored_columns)
@ignored_columns
else
superclass.ignored_columns
end
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1045
activerecord-5.2.3/lib/active_record/model_schema.rb:264
def ignored_columns
if defined?(@ignored_columns)
@ignored_columns
else
superclass.ignored_columns
end
end
# called from activerecord-5.2.3/lib/active_record/model_schema.rb:268
activerecord-5.2.3/lib/active_record/model_schema.rb:264
def ignored_columns
if defined?(@ignored_columns)
@ignored_columns
else
superclass.ignored_columns
end
end
# called from activerecord-5.2.3/lib/active_record/model_schema.rb:268
arel-9.0.0/lib/arel.rb:33
def self.star
sql '*'
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1048
arel-9.0.0/lib/arel.rb:29
def self.sql raw_sql
Arel::Nodes::SqlLiteral.new raw_sql
end
# called from arel-9.0.0/lib/arel.rb:34
arel-9.0.0/lib/arel/table.rb:80
def [] name
::Arel::Attribute.new self, name
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1048
arel-9.0.0/lib/arel/select_manager.rb:133
def project *projections
# FIXME: converting these to SQLLiterals is probably not good, but
# rails tests require it.
@ctx.projections.concat projections.map { |x|
STRING_OR_SYMBOL_CLASS.include?(x.class) ? Nodes::SqlLiteral.new(x.to_s) : x
}
self
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:1048
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:956
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
arel-9.0.0/lib/arel/select_manager.rb:150
def distinct(value = true)
if value
@ctx.set_quantifier = Arel::Nodes::Distinct.new
else
@ctx.set_quantifier = nil
end
self
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:956
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:957
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/from_clause.rb:17
def empty?
value.nil?
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:957
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:958
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/querying.rb:40
def find_by_sql(sql, binds = [], preparable: nil, &block)
result_set = connection.select_all(sanitize_sql(sql), "#{name} Load", binds, preparable: preparable)
column_types = result_set.column_types.dup
attribute_types.each_key { |k| column_types.delete k }
message_bus = ActiveSupport::Notifications.instrumenter
payload = {
record_count: result_set.length,
class_name: name
}
message_bus.instrument("instantiation.active_record", payload) do
result_set.map { |record| instantiate(record, column_types, &block) }
end
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:560
activerecord-5.2.3/lib/active_record/connection_handling.rb:89
def connection
retrieve_connection
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:41
activerecord-5.2.3/lib/active_record/connection_handling.rb:117
def retrieve_connection
connection_handler.retrieve_connection(connection_specification_name)
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:90
activerecord-5.2.3/lib/active_record/core.rb:130
def self.connection_handler
ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/core.rb:131
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:98
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:98
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1011
def retrieve_connection(spec_name) #:nodoc:
pool = retrieve_connection_pool(spec_name)
raise ConnectionNotEstablished, "No connection pool with '#{spec_name}' found." unless pool
pool.connection
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:118
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1039
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
# Check if a connection was previously established in an ancestor process,
# which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
establish_connection(ancestor_pool.spec.to_hash).tap do |pool|
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
end
else
owner_to_pool[spec_name] = nil
end
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1012
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058
def owner_to_pool
@owner_to_pool[Process.pid]
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1059
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:168
def fetch(key, default_value = NULL)
if NULL != (value = get_or_default(key, NULL))
value
elsif block_given?
yield key
elsif NULL != default_value
default_value
else
raise_fetch_no_key
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:169
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:381
def connection
@thread_cached_conns[connection_cache_key(@lock_thread || Thread.current)] ||= checkout
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1014
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:667
def connection_cache_key(thread)
thread
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/sanitization.rb:22
def sanitize_sql_for_conditions(condition)
return nil if condition.blank?
case condition
when Array; sanitize_sql_array(condition)
else condition
end
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:41
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:95
def select_all(arel, name = nil, binds = [], preparable: nil)
if @query_cache_enabled && !locked?(arel)
arel = arel_from_relation(arel)
sql, binds = to_sql_and_binds(arel, binds)
if preparable.nil?
preparable = prepared_statements ? visitor.preparable : false
end
cache_sql(sql, name, binds) { super(sql, name, binds, preparable: preparable) }
else
super
end
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:41
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:135
def locked?(arel)
arel = arel.arel if arel.is_a?(Relation)
arel.respond_to?(:locked) && arel.locked
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:96
arel-9.0.0/lib/arel/select_manager.rb:68
def locked
@ast.lock
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:137
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:498
def arel_from_relation(relation)
if relation.is_a?(Relation)
relation.arel
else
relation
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:97
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:17
def to_sql_and_binds(arel_or_sql_string, binds = []) # :nodoc:
if arel_or_sql_string.respond_to?(:ast)
unless binds.empty?
raise "Passing bind parameters with an arel AST is forbidden. " \
"The values must be stored on the AST directly"
end
if prepared_statements
sql, binds = visitor.accept(arel_or_sql_string.ast, collector).value
if binds.length > bind_params_length
unprepared_statement do
sql, binds = to_sql_and_binds(arel_or_sql_string)
visitor.preparable = false
end
end
else
sql = visitor.accept(arel_or_sql_string.ast, collector).value
end
[sql.freeze, binds]
else
visitor.preparable = false if prepared_statements
[arel_or_sql_string.dup.freeze, binds]
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:98
activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:609
def collector
if prepared_statements
Arel::Collectors::Composite.new(
Arel::Collectors::SQLString.new,
Arel::Collectors::Bind.new,
)
else
Arel::Collectors::SubstituteBinds.new(
self,
Arel::Collectors::SQLString.new,
)
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:25
arel-9.0.0/lib/arel/collectors/sql_string.rb:8
def initialize(*)
super
@bind_index = 1
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:612
arel-9.0.0/lib/arel/collectors/plain_string.rb:5
def initialize(*)
super
@bind_index = 1
end
# called from arel-9.0.0/lib/arel/collectors/sql_string.rb:9
arel-9.0.0/lib/arel/collectors/bind.rb:6
def initialize
@binds = []
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:613
arel-9.0.0/lib/arel/collectors/composite.rb:6
def initialize(left, right)
@left = left
@right = right
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:611
activerecord-5.2.3/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb:8
def accept(*)
@preparable = true
super
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:25
arel-9.0.0/lib/arel/visitors/reduce.rb:7
def accept(*)
@preparable = true
super
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb:10
arel-9.0.0/lib/arel/visitors/reduce.rb:13
def visit object, collector
dispatch_method = dispatch[object.class]
send dispatch_method, object, collector
rescue NoMethodError => e
raise e if respond_to?(dispatch_method, true)
superklass = object.class.ancestors.find { |klass|
respond_to?(dispatch[klass], true)
}
raise(TypeError, "Cannot visit #{object.class}") unless superklass
dispatch[object.class] = dispatch[superklass]
retry
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:8
arel-9.0.0/lib/arel/visitors/visitor.rb:25
def dispatch
@dispatch
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:14
arel-9.0.0/lib/arel/visitors/sqlite.rb:12
def visit_Arel_Nodes_SelectStatement o, collector
o.limit = Arel::Nodes::Limit.new(-1) if o.offset && !o.limit
super
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:15
arel-9.0.0/lib/arel/visitors/to_sql.rb:210
def visit_Arel_Nodes_SelectStatement o, collector
o.limit = Arel::Nodes::Limit.new(-1) if o.offset && !o.limit
super
end
# called from arel-9.0.0/lib/arel/visitors/sqlite.rb:14
arel-9.0.0/lib/arel/visitors/to_sql.rb:240
def visit_Arel_Nodes_SelectCore o, collector
collector << "SELECT"
collector = maybe_visit o.top, collector
collector = maybe_visit o.set_quantifier, collector
collect_nodes_for o.projections, collector, SPACE
if o.source && !o.source.empty?
collector << " FROM "
collector = visit o.source, collector
end
collect_nodes_for o.wheres, collector, WHERE, AND
collect_nodes_for o.groups, collector, GROUP_BY
unless o.havings.empty?
collector << " HAVING "
inject_join o.havings, collector, AND
end
collect_nodes_for o.windows, collector, WINDOW
collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:217
arel-9.0.0/lib/arel/collectors/composite.rb:11
def << str
left << str
right << str
self
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:241
arel-9.0.0/lib/arel/collectors/plain_string.rb:13
def << str
@str << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:12
arel-9.0.0/lib/arel/collectors/bind.rb:10
def << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:13
arel-9.0.0/lib/arel/visitors/to_sql.rb:812
def maybe_visit thing, collector
return collector unless thing
collector << " "
visit thing, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:243
arel-9.0.0/lib/arel/visitors/to_sql.rb:812
def maybe_visit thing, collector
return collector unless thing
collector << " "
visit thing, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:245
arel-9.0.0/lib/arel/visitors/to_sql.rb:265
def collect_nodes_for nodes, collector, spacer, connector = COMMA
unless nodes.empty?
collector << spacer
len = nodes.length - 1
nodes.each_with_index do |x, i|
collector = visit(x, collector)
collector << connector unless len == i
end
end
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:247
arel-9.0.0/lib/arel/collectors/composite.rb:11
def << str
left << str
right << str
self
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:267
arel-9.0.0/lib/arel/collectors/plain_string.rb:13
def << str
@str << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:12
arel-9.0.0/lib/arel/collectors/bind.rb:10
def << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:13
arel-9.0.0/lib/arel/visitors/reduce.rb:13
def visit object, collector
dispatch_method = dispatch[object.class]
send dispatch_method, object, collector
rescue NoMethodError => e
raise e if respond_to?(dispatch_method, true)
superklass = object.class.ancestors.find { |klass|
respond_to?(dispatch[klass], true)
}
raise(TypeError, "Cannot visit #{object.class}") unless superklass
dispatch[object.class] = dispatch[superklass]
retry
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:270
arel-9.0.0/lib/arel/visitors/visitor.rb:25
def dispatch
@dispatch
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:14
arel-9.0.0/lib/arel/visitors/to_sql.rb:727
def visit_Arel_Attributes_Attribute o, collector
join_name = o.relation.table_alias || o.relation.name
collector << "#{quote_table_name join_name}.#{quote_column_name o.name}"
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:15
arel-9.0.0/lib/arel/visitors/to_sql.rb:802
def quote_table_name name
return name if Arel::Nodes::SqlLiteral === name
@connection.quote_table_name(name)
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:729
activerecord-5.2.3/lib/active_record/connection_adapters/sqlite3/quoting.rb:15
def quote_table_name(name)
@quoted_table_names[name] ||= super.gsub(".", "\".\"").freeze
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:804
arel-9.0.0/lib/arel/visitors/to_sql.rb:807
def quote_column_name name
return name if Arel::Nodes::SqlLiteral === name
@connection.quote_column_name(name)
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:729
arel-9.0.0/lib/arel/collectors/composite.rb:11
def << str
left << str
right << str
self
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:729
arel-9.0.0/lib/arel/collectors/plain_string.rb:13
def << str
@str << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:12
arel-9.0.0/lib/arel/collectors/bind.rb:10
def << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:13
arel-9.0.0/lib/arel/nodes/join_source.rb:14
def empty?
!left && right.empty?
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:249
arel-9.0.0/lib/arel/collectors/composite.rb:11
def << str
left << str
right << str
self
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:250
arel-9.0.0/lib/arel/collectors/plain_string.rb:13
def << str
@str << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:12
arel-9.0.0/lib/arel/collectors/bind.rb:10
def << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:13
arel-9.0.0/lib/arel/visitors/reduce.rb:13
def visit object, collector
dispatch_method = dispatch[object.class]
send dispatch_method, object, collector
rescue NoMethodError => e
raise e if respond_to?(dispatch_method, true)
superklass = object.class.ancestors.find { |klass|
respond_to?(dispatch[klass], true)
}
raise(TypeError, "Cannot visit #{object.class}") unless superklass
dispatch[object.class] = dispatch[superklass]
retry
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:251
arel-9.0.0/lib/arel/visitors/visitor.rb:25
def dispatch
@dispatch
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:14
arel-9.0.0/lib/arel/visitors/to_sql.rb:544
def visit_Arel_Nodes_JoinSource o, collector
if o.left
collector = visit o.left, collector
end
if o.right.any?
collector << SPACE if o.left
collector = inject_join o.right, collector, SPACE
end
collector
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:15
arel-9.0.0/lib/arel/visitors/reduce.rb:13
def visit object, collector
dispatch_method = dispatch[object.class]
send dispatch_method, object, collector
rescue NoMethodError => e
raise e if respond_to?(dispatch_method, true)
superklass = object.class.ancestors.find { |klass|
respond_to?(dispatch[klass], true)
}
raise(TypeError, "Cannot visit #{object.class}") unless superklass
dispatch[object.class] = dispatch[superklass]
retry
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:546
arel-9.0.0/lib/arel/visitors/visitor.rb:25
def dispatch
@dispatch
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:14
arel-9.0.0/lib/arel/visitors/to_sql.rb:609
def visit_Arel_Table o, collector
if o.table_alias
collector << "#{quote_table_name o.name} #{quote_table_name o.table_alias}"
else
collector << quote_table_name(o.name)
end
end
# called from arel-9.0.0/lib/arel/visitors/reduce.rb:15
arel-9.0.0/lib/arel/visitors/to_sql.rb:802
def quote_table_name name
return name if Arel::Nodes::SqlLiteral === name
@connection.quote_table_name(name)
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:613
activerecord-5.2.3/lib/active_record/connection_adapters/sqlite3/quoting.rb:15
def quote_table_name(name)
@quoted_table_names[name] ||= super.gsub(".", "\".\"").freeze
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:804
arel-9.0.0/lib/arel/collectors/composite.rb:11
def << str
left << str
right << str
self
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:613
arel-9.0.0/lib/arel/collectors/plain_string.rb:13
def << str
@str << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:12
arel-9.0.0/lib/arel/collectors/bind.rb:10
def << str
self
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:13
arel-9.0.0/lib/arel/visitors/to_sql.rb:265
def collect_nodes_for nodes, collector, spacer, connector = COMMA
unless nodes.empty?
collector << spacer
len = nodes.length - 1
nodes.each_with_index do |x, i|
collector = visit(x, collector)
collector << connector unless len == i
end
end
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:254
arel-9.0.0/lib/arel/visitors/to_sql.rb:265
def collect_nodes_for nodes, collector, spacer, connector = COMMA
unless nodes.empty?
collector << spacer
len = nodes.length - 1
nodes.each_with_index do |x, i|
collector = visit(x, collector)
collector << connector unless len == i
end
end
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:255
arel-9.0.0/lib/arel/visitors/to_sql.rb:265
def collect_nodes_for nodes, collector, spacer, connector = COMMA
unless nodes.empty?
collector << spacer
len = nodes.length - 1
nodes.each_with_index do |x, i|
collector = visit(x, collector)
collector << connector unless len == i
end
end
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:260
arel-9.0.0/lib/arel/visitors/to_sql.rb:234
def visit_Arel_Nodes_SelectOptions o, collector
collector = maybe_visit o.limit, collector
collector = maybe_visit o.offset, collector
collector = maybe_visit o.lock, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:229
arel-9.0.0/lib/arel/visitors/to_sql.rb:812
def maybe_visit thing, collector
return collector unless thing
collector << " "
visit thing, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:235
arel-9.0.0/lib/arel/visitors/to_sql.rb:812
def maybe_visit thing, collector
return collector unless thing
collector << " "
visit thing, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:236
arel-9.0.0/lib/arel/visitors/to_sql.rb:812
def maybe_visit thing, collector
return collector unless thing
collector << " "
visit thing, collector
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:237
arel-9.0.0/lib/arel/collectors/composite.rb:23
def value
[left.value, right.value]
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:25
arel-9.0.0/lib/arel/collectors/plain_string.rb:9
def value
@str
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:24
arel-9.0.0/lib/arel/collectors/bind.rb:19
def value
@binds
end
# called from arel-9.0.0/lib/arel/collectors/composite.rb:24
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_limits.rb:67
def bind_params_length
65535
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:27
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:112
def cache_sql(sql, name, binds)
@lock.synchronize do
result =
if @query_cache[sql].key?(binds)
ActiveSupport::Notifications.instrument(
"sql.active_record",
sql: sql,
binds: binds,
type_casted_binds: -> { type_casted_binds(binds) },
name: name,
connection_id: object_id,
cached: true,
)
@query_cache[sql][binds]
else
@query_cache[sql][binds] = yield
end
result.dup
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:104
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:80
activerecord-5.2.3/lib/active_record/explain_subscriber.rb:8
def start(name, id, payload)
# unused
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:100
activerecord-5.2.3/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:84
activerecord-5.2.3/lib/active_record/log_subscriber.rb:20
def sql(event)
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
name = "CACHE #{name}" if payload[:cached]
sql = payload[:sql]
binds = nil
unless (payload[:binds] || []).empty?
casted_params = type_casted_binds(payload[:type_casted_binds])
binds = " " + payload[:binds].zip(casted_params).map { |attr, value|
render_bind(attr, value)
}.inspect
end
name = colorize_payload_name(name, payload[:name])
sql = color(sql, sql_color(sql), true)
debug " #{name} #{sql}#{binds}"
end
# called from activesupport-5.2.3/lib/active_support/subscriber.rb:101
activerecord-5.2.3/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:21
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:12
activerecord-5.2.3/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:21
activerecord-5.2.3/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:8
activerecord-5.2.3/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:22
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/log_subscriber.rb:61
def colorize_payload_name(name, payload_name)
if payload_name.blank? || payload_name == "SQL" # SQL vs Model Load/Exists
color(name, MAGENTA, true)
else
color(name, CYAN, true)
end
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:40
activerecord-5.2.3/lib/active_record/log_subscriber.rb:69
def sql_color(sql)
case sql
when /\A\s*rollback/mi
RED
when /select .*for update/mi, /\A\s*lock/mi
WHITE
when /\A\s*select/i
BLUE
when /\A\s*insert/i
GREEN
when /\A\s*update/i
YELLOW
when /\A\s*delete/i
RED
when /transaction\s*\Z/i
CYAN
else
MAGENTA
end
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:41
activerecord-5.2.3/lib/active_record/log_subscriber.rb:94
def debug(progname = nil, &block)
return unless super
if ActiveRecord::Base.verbose_query_logs
log_query_source
end
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:43
activerecord-5.2.3/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
activerecord-5.2.3/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/explain_subscriber.rb:12
def finish(name, id, payload)
if ExplainRegistry.collect? && !ignore_payload?(payload)
ExplainRegistry.queries << payload.values_at(:sql, :binds)
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:104
activerecord-5.2.3/lib/active_record/explain_registry.rb:23
def collect?
@collect
end
# called from activesupport-5.2.3/lib/active_support/per_thread_registry.rb:55
activerecord-5.2.3/lib/active_record/result.rb:108
def initialize_copy(other)
@columns = columns.dup
@rows = rows.dup
@column_types = column_types.dup
@hash_rows = nil
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:129
activerecord-5.2.3/lib/active_record/model_schema.rb:345
def attribute_types # :nodoc:
load_schema
@attribute_types ||= Hash.new(Type.default_value)
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:43
activerecord-5.2.3/lib/active_record/model_schema.rb:454
def load_schema
return if schema_loaded?
@load_schema_monitor.synchronize do
return if defined?(@columns_hash) && @columns_hash
load_schema!
@schema_loaded = true
end
end
# called from activerecord-5.2.3/lib/active_record/model_schema.rb:346
activerecord-5.2.3/lib/active_record/model_schema.rb:450
def schema_loaded?
defined?(@schema_loaded) && @schema_loaded
end
# called from activerecord-5.2.3/lib/active_record/model_schema.rb:455
activerecord-5.2.3/lib/active_record/result.rb:47
def length
@rows.length
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:47
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/result.rb:55
def each
if block_given?
hash_rows.each { |row| yield row }
else
hash_rows.to_enum { @rows.size }
end
end
# called from activerecord-5.2.3/lib/active_record/querying.rb:52
activerecord-5.2.3/lib/active_record/result.rb:123
def hash_rows
@hash_rows ||=
begin
# We freeze the strings to prevent them getting duped when
# used as keys in ActiveRecord::Base's @attributes hash
columns = @columns.map { |c| c.dup.freeze }
@rows.map { |row|
# In the past we used Hash[columns.zip(row)]
# though elegant, the verbose way is much more efficient
# both time and memory wise cause it avoids a big array allocation
# this method is called a lot and needs to be micro optimised
hash = {}
index = 0
length = columns.length
while index < length
hash[columns[index]] = row[index]
index += 1
end
hash
}
end
end
# called from activerecord-5.2.3/lib/active_record/result.rb:57
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:563
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation.rb:472
def eager_loading?
@should_eager_load ||=
eager_load_values.any? ||
includes_values.any? && (joined_includes_values.any? || references_eager_loaded_tables?)
end
# called from activerecord-5.2.3/lib/active_record/relation.rb:564
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:474
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:475
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:564
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:69
def #{method_name} # def includes_values
get_value(#{name.inspect}) # get_value(:includes)
end # end
# called from activerecord-5.2.3/lib/active_record/relation.rb:571
activerecord-5.2.3/lib/active_record/relation/query_methods.rb:907
def get_value(name) # :nodoc:
@values.fetch(name, DEFAULT_VALUES[name])
end
# called from activerecord-5.2.3/lib/active_record/relation/query_methods.rb:70
actionpack-5.2.3/lib/action_controller/metal.rb:150
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, to: "@_response"
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:166
actionpack-5.2.3/lib/action_dispatch/http/response.rb:247
def content_type
parsed_content_type_header.mime_type
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:150
actionpack-5.2.3/lib/action_dispatch/http/response.rb:422
def parsed_content_type_header
parse_content_type(get_header(CONTENT_TYPE))
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:248
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/response.rb:412
def parse_content_type(content_type)
if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:type], match[:charset])
else
NullContentTypeHeader
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:40
def [](type)
return type if type.is_a?(Type)
Type.lookup_by_extension(type)
end
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:166
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:148
def lookup_by_extension(extension)
EXTENSION_LOOKUP[extension.to_s]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:42
actionpack-5.2.3/lib/action_controller/metal.rb:150
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, to: "@_response"
# called from actionpack-5.2.3/lib/action_controller/metal/renderers.rb:166
actionpack-5.2.3/lib/action_dispatch/http/response.rb:229
def content_type=(content_type)
return unless content_type
new_header_info = parse_content_type(content_type.to_s)
prev_header_info = parsed_content_type_header
charset = new_header_info.charset || prev_header_info.charset
charset ||= self.class.default_charset unless prev_header_info.mime_type
set_content_type new_header_info.mime_type, charset
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:150
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:232
def to_s
@string
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:231
actionpack-5.2.3/lib/action_dispatch/http/response.rb:412
def parse_content_type(content_type)
if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:type], match[:charset])
else
NullContentTypeHeader
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:231
actionpack-5.2.3/lib/action_dispatch/http/response.rb:422
def parsed_content_type_header
parse_content_type(get_header(CONTENT_TYPE))
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:232
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/response.rb:412
def parse_content_type(content_type)
if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:type], match[:charset])
else
NullContentTypeHeader
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/response.rb:426
def set_content_type(content_type, charset)
type = (content_type || "").dup
type << "; charset=#{charset.to_s.downcase}" if charset
set_header CONTENT_TYPE, type
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:235
actionpack-5.2.3/lib/action_dispatch/http/response.rb:183
def set_header(key, v); headers[key] = v; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:429
actionpack-5.2.3/lib/action_dispatch/http/response.rb:44
def []=(k, v)
if @response.sending? || @response.sent?
raise ActionDispatch::IllegalStateError, "header already sent"
end
super
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:183
actionpack-5.2.3/lib/action_dispatch/http/response.rb:219
def sending?; synchronize { @sending }; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:45
actionpack-5.2.3/lib/action_dispatch/http/response.rb:221
def sent?; synchronize { @sent }; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:45
actionpack-5.2.3/lib/abstract_controller/rendering.rb:54
def rendered_format
Mime[:text]
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:29
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:40
def [](type)
return type if type.is_a?(Type)
Type.lookup_by_extension(type)
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:55
actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:148
def lookup_by_extension(extension)
EXTENSION_LOOKUP[extension.to_s]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/mime_type.rb:42
actionpack-5.2.3/lib/action_controller/metal/rendering.rb:75
def _set_rendered_content_type(format)
if format && !response.content_type
self.content_type = format.to_s
end
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:29
actionpack-5.2.3/lib/action_dispatch/http/response.rb:247
def content_type
parsed_content_type_header.mime_type
end
# called from actionpack-5.2.3/lib/action_controller/metal/rendering.rb:76
actionpack-5.2.3/lib/action_dispatch/http/response.rb:422
def parsed_content_type_header
parse_content_type(get_header(CONTENT_TYPE))
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:248
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/response.rb:412
def parse_content_type(content_type)
if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:type], match[:charset])
else
NullContentTypeHeader
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_controller/metal.rb:175
def response_body=(body)
body = [body] unless body.nil? || body.respond_to?(:each)
response.reset_body!
return unless body
response.body = body
super
end
# called from actionpack-5.2.3/lib/abstract_controller/rendering.rb:31
actionpack-5.2.3/lib/action_dispatch/http/response.rb:352
def reset_body!
@stream = build_buffer(self, [])
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:177
actionpack-5.2.3/lib/action_dispatch/http/response.rb:452
def build_buffer(response, body)
Buffer.new response, body
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:353
actionpack-5.2.3/lib/action_dispatch/http/response.rb:100
def initialize(response, buf)
@response = response
@buf = buf
@closed = false
@str_body = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:453
actionpack-5.2.3/lib/action_dispatch/http/response.rb:312
def body=(body)
if body.respond_to?(:to_path)
@stream = body
else
synchronize do
@stream = build_buffer self, munge_body_object(body)
end
end
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:179
actionpack-5.2.3/lib/action_dispatch/http/response.rb:456
def munge_body_object(body)
body.respond_to?(:each) ? body : [body]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:317
actionpack-5.2.3/lib/action_dispatch/http/response.rb:452
def build_buffer(response, body)
Buffer.new response, body
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:317
actionpack-5.2.3/lib/action_dispatch/http/response.rb:100
def initialize(response, buf)
@response = response
@buf = buf
@closed = false
@str_body = nil
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:453
activerecord-5.2.3/lib/active_record/log_subscriber.rb:15
def self.reset_runtime
rt, self.runtime = runtime, 0
rt
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:32
activerecord-5.2.3/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:12
activerecord-5.2.3/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:8
actionpack-5.2.3/lib/action_controller/metal.rb:184
def performed?
response_body || response.committed?
end
# called from actionpack-5.2.3/lib/action_controller/metal/basic_implicit_render.rb:6
activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:40
def append_info_to_payload(payload)
super
if ActiveRecord::Base.connected?
payload[:db_runtime] = (db_runtime || 0) + ActiveRecord::LogSubscriber.reset_runtime
end
end
# called from actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:38
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:92
def append_info_to_payload(payload)
super
if ActiveRecord::Base.connected?
payload[:db_runtime] = (db_runtime || 0) + ActiveRecord::LogSubscriber.reset_runtime
end
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:41
activerecord-5.2.3/lib/active_record/connection_handling.rb:122
def connected?
connection_handler.connected?(connection_specification_name)
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:42
activerecord-5.2.3/lib/active_record/core.rb:130
def self.connection_handler
ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/core.rb:131
activerecord-5.2.3/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1019
def connected?(spec_name)
conn = retrieve_connection_pool(spec_name)
conn && conn.connected?
end
# called from activerecord-5.2.3/lib/active_record/connection_handling.rb:123
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1039
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
# Check if a connection was previously established in an ancestor process,
# which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
establish_connection(ancestor_pool.spec.to_hash).tap do |pool|
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
end
else
owner_to_pool[spec_name] = nil
end
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1020
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058
def owner_to_pool
@owner_to_pool[Process.pid]
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1059
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:168
def fetch(key, default_value = NULL)
if NULL != (value = get_or_default(key, NULL))
value
elsif block_given?
yield key
elsif NULL != default_value
default_value
else
raise_fetch_no_key
end
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1040
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:169
activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422
def connected?
synchronize { @connections.any? }
end
# called from activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1021
activerecord-5.2.3/lib/active_record/log_subscriber.rb:15
def self.reset_runtime
rt, self.runtime = runtime, 0
rt
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:43
activerecord-5.2.3/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:12
activerecord-5.2.3/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:16
activerecord-5.2.3/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.3/lib/active_record/log_subscriber.rb:8
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:84
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:19
def process_action(event)
info do
payload = event.payload
additions = ActionController::Base.log_process_action(payload)
status = payload[:status]
if status.nil? && payload[:exception].present?
exception_class_name = payload[:exception].first
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
end
message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms".dup
message << " (#{additions.join(" | ".freeze)})" unless additions.empty?
message << "\n\n" if defined?(Rails.env) && Rails.env.development?
message
end
end
# called from activesupport-5.2.3/lib/active_support/subscriber.rb:101
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
actionpack-5.2.3/lib/action_controller/log_subscriber.rb:72
def logger
ActionController::Base.logger
end
# called from activesupport-5.2.3/lib/active_support/log_subscriber.rb:96
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:48
def log_process_action(payload)
messages, db_runtime = super, payload[:db_runtime]
messages << ("ActiveRecord: %.1fms" % db_runtime.to_f) if db_runtime
messages
end
# called from actionpack-5.2.3/lib/action_controller/log_subscriber.rb:22
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:100
def log_process_action(payload)
messages, db_runtime = super, payload[:db_runtime]
messages << ("ActiveRecord: %.1fms" % db_runtime.to_f) if db_runtime
messages
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:49
railties-5.2.3/lib/rails.rb:72
def env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development")
end
# called from actionpack-5.2.3/lib/action_controller/log_subscriber.rb:31
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:48
def log_process_action(payload)
messages, db_runtime = super, payload[:db_runtime]
messages << ("ActiveRecord: %.1fms" % db_runtime.to_f) if db_runtime
messages
end
# called from actionpack-5.2.3/lib/action_controller/log_subscriber.rb:22
actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:100
def log_process_action(payload)
messages, db_runtime = super, payload[:db_runtime]
messages << ("ActiveRecord: %.1fms" % db_runtime.to_f) if db_runtime
messages
end
# called from activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:49
railties-5.2.3/lib/rails.rb:72
def env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development")
end
# called from actionpack-5.2.3/lib/action_controller/log_subscriber.rb:31
actionpack-5.2.3/lib/action_dispatch/http/request.rb:417
def commit_flash
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:192
actionpack-5.2.3/lib/action_controller/metal.rb:205
def to_a #:nodoc:
response.to_a
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:193
actionpack-5.2.3/lib/action_dispatch/http/response.rb:384
def to_a
commit!
rack_response @status, @header.to_hash
end
# called from actionpack-5.2.3/lib/action_controller/metal.rb:206
actionpack-5.2.3/lib/action_dispatch/http/response.rb:196
def commit!
synchronize do
before_committed
@committed = true
@cv.broadcast
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:385
actionpack-5.2.3/lib/action_dispatch/http/response.rb:432
def before_committed
return if committed?
assign_default_content_type_and_charset!
merge_and_normalize_cache_control!(@cache_control)
handle_conditional_get!
handle_no_content!
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:198
actionpack-5.2.3/lib/action_dispatch/http/response.rb:220
def committed?; synchronize { @committed }; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:433
actionpack-5.2.3/lib/action_dispatch/http/response.rb:460
def assign_default_content_type_and_charset!
return if content_type
ct = parsed_content_type_header
set_content_type(ct.mime_type || Mime[:html].to_s,
ct.charset || self.class.default_charset)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:434
actionpack-5.2.3/lib/action_dispatch/http/response.rb:247
def content_type
parsed_content_type_header.mime_type
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:461
actionpack-5.2.3/lib/action_dispatch/http/response.rb:422
def parsed_content_type_header
parse_content_type(get_header(CONTENT_TYPE))
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:248
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/response.rb:412
def parse_content_type(content_type)
if content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:type], match[:charset])
else
NullContentTypeHeader
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:423
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:185
def merge_and_normalize_cache_control!(cache_control)
control = {}
cc_headers = cache_control_headers
if extras = cc_headers.delete(:extras)
cache_control[:extras] ||= []
cache_control[:extras] += extras
cache_control[:extras].uniq!
end
control.merge! cc_headers
control.merge! cache_control
if control.empty?
# Let middleware handle default behavior
elsif control[:no_cache]
options = []
options << PUBLIC if control[:public]
options << NO_CACHE
options.concat(control[:extras]) if control[:extras]
self._cache_control = options.join(", ")
else
extras = control[:extras]
max_age = control[:max_age]
options = []
options << "max-age=#{max_age.to_i}" if max_age
options << (control[:public] ? PUBLIC : PRIVATE)
options << MUST_REVALIDATE if control[:must_revalidate]
options.concat(extras) if extras
self._cache_control = options.join(", ")
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:435
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:147
def cache_control_headers
cache_control = {}
cache_control_segments.each do |segment|
directive, argument = segment.split("=", 2)
if SPECIAL_KEYS.include? directive
key = directive.tr("-", "_")
cache_control[key.to_sym] = argument || true
else
cache_control[:extras] ||= []
cache_control[:extras] << segment
end
end
cache_control
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:187
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:139
def cache_control_segments
if cache_control = _cache_control
cache_control.delete(" ").split(",")
else
[]
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:150
rack-2.0.7/lib/rack/response.rb:199
attr_reader :cache_control
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:140
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from rack-2.0.7/lib/rack/response.rb:200
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:175
def handle_conditional_get!
# Normally default cache control setting is handled by ETag
# middleware. But, if an etag is already set, the middleware
# defaults to `no-cache` unless a default `Cache-Control` value is
# previously set. So, set a default one here.
if (etag? || last_modified?) && !self._cache_control
self._cache_control = DEFAULT_CACHE_CONTROL
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:436
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:113
def etag?; etag; end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:180
rack-2.0.7/lib/rack/response.rb:207
def etag
get_header ETAG
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:113
actionpack-5.2.3/lib/action_dispatch/http/response.rb:182
def get_header(key); headers[key]; end
# called from rack-2.0.7/lib/rack/response.rb:208
actionpack-5.2.3/lib/action_dispatch/http/cache.rb:60
def last_modified?
has_header? LAST_MODIFIED
end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:180
actionpack-5.2.3/lib/action_dispatch/http/response.rb:181
def has_header?(key); headers.key? key; end
# called from actionpack-5.2.3/lib/action_dispatch/http/cache.rb:61
actionpack-5.2.3/lib/action_dispatch/http/response.rb:504
def handle_no_content!
if NO_CONTENT_CODES.include?(@status)
@header.delete CONTENT_TYPE
@header.delete "Content-Length"
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:437
actionpack-5.2.3/lib/action_dispatch/http/response.rb:56
def to_hash
__getobj__.dup
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:386
actionpack-5.2.3/lib/action_dispatch/http/response.rb:511
def rack_response(status, header)
if NO_CONTENT_CODES.include?(status)
[status, header, []]
else
[status, header, RackBody.new(self)]
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:386
actionpack-5.2.3/lib/action_dispatch/http/response.rb:469
def initialize(response)
@response = response
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:515
rack-2.0.7/lib/rack/etag.rb:49
def etag_status?(status)
status == 200 || status == 201
end
# called from rack-2.0.7/lib/rack/etag.rb:27
rack-2.0.7/lib/rack/etag.rb:53
def etag_body?(body)
!body.respond_to?(:to_path)
end
# called from rack-2.0.7/lib/rack/etag.rb:27
actionpack-5.2.3/lib/action_dispatch/http/response.rb:487
def respond_to?(method, include_private = false)
if method.to_s == "to_path"
@response.stream.respond_to?(method)
else
super
end
end
# called from rack-2.0.7/lib/rack/etag.rb:54
rack-2.0.7/lib/rack/etag.rb:57
def skip_caching?(headers)
(headers[CACHE_CONTROL] && headers[CACHE_CONTROL].include?('no-cache')) ||
headers.key?(ETAG_STRING) || headers.key?('Last-Modified')
end
# called from rack-2.0.7/lib/rack/etag.rb:27
rack-2.0.7/lib/rack/etag.rb:62
def digest_body(body)
parts = []
digest = nil
body.each do |part|
parts << part
(digest ||= Digest::SHA256.new) << part unless part.empty?
end
[digest && digest.hexdigest.byteslice(0, 32), parts]
end
# called from rack-2.0.7/lib/rack/etag.rb:29
actionpack-5.2.3/lib/action_dispatch/http/response.rb:473
def each(*args, &block)
@response.each(*args, &block)
end
# called from rack-2.0.7/lib/rack/etag.rb:66
actionpack-5.2.3/lib/action_dispatch/http/response.rb:74
def each(&block)
sending!
x = @stream.each(&block)
sent!
x
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:474
actionpack-5.2.3/lib/action_dispatch/http/response.rb:204
def sending!
synchronize do
before_sending
@sending = true
@cv.broadcast
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:75
actionpack-5.2.3/lib/action_dispatch/http/response.rb:440
def before_sending
# Normally we've already committed by now, but it's possible
# (e.g., if the controller action tries to read back its own
# response) to get here before that. In that case, we must force
# an "early" commit: we're about to freeze the headers, so this is
# our last chance.
commit! unless committed?
headers.freeze
request.commit_cookie_jar! unless committed?
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:206
actionpack-5.2.3/lib/action_dispatch/http/response.rb:220
def committed?; synchronize { @committed }; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:446
actionpack-5.2.3/lib/action_dispatch/http/response.rb:220
def committed?; synchronize { @committed }; end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:449
actionpack-5.2.3/lib/action_dispatch/http/response.rb:123
def each(&block)
if @str_body
return enum_for(:each) unless block_given?
yield @str_body
else
each_chunk(&block)
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:76
actionpack-5.2.3/lib/action_dispatch/http/response.rb:147
def each_chunk(&block)
@buf.each(&block)
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:129
actionpack-5.2.3/lib/action_dispatch/http/response.rb:212
def sent!
synchronize do
@sent = true
@cv.broadcast
end
end
# called from actionpack-5.2.3/lib/action_dispatch/http/response.rb:77
rack-2.0.7/lib/rack/body_proxy.rb:3
def initialize(body, &block)
@body = body
@block = block
@closed = false
end
# called from rack-2.0.7/lib/rack/etag.rb:30
rack-2.0.7/lib/rack/utils.rb:436
def self.new(hash={})
HeaderHash === hash ? hash : super(hash)
end
# called from rack-2.0.7/lib/rack/conditional_get.rb:26
rack-2.0.7/lib/rack/utils.rb:440
def initialize(hash={})
super()
@names = {}
hash.each { |k, v| self[k] = v }
end
# called from rack-2.0.7/lib/rack/utils.rb:437
rack-2.0.7/lib/rack/utils.rb:468
def []=(k, v)
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[canonical] = k
super k, v
end
# called from rack-2.0.7/lib/rack/utils.rb:443
rack-2.0.7/lib/rack/utils.rb:468
def []=(k, v)
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[canonical] = k
super k, v
end
# called from rack-2.0.7/lib/rack/utils.rb:443
rack-2.0.7/lib/rack/utils.rb:468
def []=(k, v)
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[canonical] = k
super k, v
end
# called from rack-2.0.7/lib/rack/utils.rb:443
rack-2.0.7/lib/rack/conditional_get.rb:44
def fresh?(env, headers)
modified_since = env['HTTP_IF_MODIFIED_SINCE']
none_match = env['HTTP_IF_NONE_MATCH']
return false unless modified_since || none_match
success = true
success &&= modified_since?(to_rfc2822(modified_since), headers) if modified_since
success &&= etag_matches?(none_match, headers) if none_match
success
end
# called from rack-2.0.7/lib/rack/conditional_get.rb:27
rack-2.0.7/lib/rack/body_proxy.rb:3
def initialize(body, &block)
@body = body
@block = block
@closed = false
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:15
rack-2.0.7/lib/rack/utils.rb:464
def [](k)
super(k) || super(@names[k.downcase])
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:63
rack-2.0.7/lib/rack/body_proxy.rb:3
def initialize(body, &block)
@body = body
@block = block
@closed = false
end
# called from railties-5.2.3/lib/rails/rack/logger.rb:39
actionpack-5.2.3/lib/action_dispatch/http/request.rb:294
def request_id
get_header ACTION_DISPATCH_REQUEST_ID
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:27
rack-2.0.7/lib/rack/request.rb:52
def get_header(name)
@env[name]
end
# called from actionpack-5.2.3/lib/action_dispatch/http/request.rb:295
rack-2.0.7/lib/rack/utils.rb:468
def []=(k, v)
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[canonical] = k
super k, v
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:27
rack-2.0.7/lib/rack/utils.rb:81
def clock_time
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from rack-2.0.7/lib/rack/runtime.rb:23
rack-2.0.7/lib/rack/utils.rb:481
def include?(k)
super || @names.include?(k.downcase)
end
# called from rack-2.0.7/lib/rack/runtime.rb:25
rack-2.0.7/lib/rack/utils.rb:468
def []=(k, v)
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[canonical] = k
super k, v
end
# called from rack-2.0.7/lib/rack/runtime.rb:26
rack-2.0.7/lib/rack/body_proxy.rb:3
def initialize(body, &block)
@body = body
@block = block
@closed = false
end
# called from activesupport-5.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:30
rack-2.0.7/lib/rack/body_proxy.rb:3
def initialize(body, &block)
@body = body
@block = block
@closed = false
end
# called from actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:15
rack-2.0.7/lib/rack/body_proxy.rb:9
def respond_to?(method_name, include_all=false)
case method_name
when :to_ary, 'to_ary'
return false
end
super or @body.respond_to?(method_name, include_all)
end
# called from rack-2.0.7/lib/rack/sendfile.rb:112
rack-2.0.7/lib/rack/body_proxy.rb:9
def respond_to?(method_name, include_all=false)
case method_name
when :to_ary, 'to_ary'
return false
end
super or @body.respond_to?(method_name, include_all)
end
# called from rack-2.0.7/lib/rack/body_proxy.rb:14
rack-2.0.7/lib/rack/body_proxy.rb:9
def respond_to?(method_name, include_all=false)
case method_name
when :to_ary, 'to_ary'
return false
end
super or @body.respond_to?(method_name, include_all)
end
# called from rack-2.0.7/lib/rack/body_proxy.rb:14
rack-2.0.7/lib/rack/body_proxy.rb:9
def respond_to?(method_name, include_all=false)
case method_name
when :to_ary, 'to_ary'
return false
end
super or @body.respond_to?(method_name, include_all)
end
# called from rack-2.0.7/lib/rack/body_proxy.rb:14