aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Bigg <git@ryanbigg.com>2015-07-23 07:51:28 +1000
committerRyan Bigg <git@ryanbigg.com>2015-07-23 07:55:28 +1000
commitf96b19b6da582bc99dde3f74aeee6ff68353d7c9 (patch)
tree2cad109c022f7af5a35e2b33608abe9c0e29d8ae
parent52cf1a71b393486435fab4386a8663b146608996 (diff)
downloadrails-f96b19b6da582bc99dde3f74aeee6ff68353d7c9.tar.gz
rails-f96b19b6da582bc99dde3f74aeee6ff68353d7c9.tar.bz2
rails-f96b19b6da582bc99dde3f74aeee6ff68353d7c9.zip
Remove check for caller_locations in Rails::Engine
This is no longer necessary, as the minimum version requirement for Ruby is 2.2.2, and the `caller_locations` feature was added in Ruby 2.0.0. Since Rails no longer supports pre 2.0 versions of Ruby, there is no need to check first if the Kernel does respond to `caller_locations`. The answer is: yes it does.
-rw-r--r--railties/lib/rails/engine.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 1dede32dd4..64c15f8f89 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -357,12 +357,7 @@ module Rails
Rails::Railtie::Configuration.eager_load_namespaces << base
base.called_from = begin
- call_stack = if Kernel.respond_to?(:caller_locations)
- caller_locations.map { |l| l.absolute_path || l.path }
- else
- # Remove the line number from backtraces making sure we don't leave anything behind
- caller.map { |p| p.sub(/:\d+.*/, '') }
- end
+ call_stack = caller_locations.map { |l| l.absolute_path || l.path }
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
end