有没有办法告诉 Rails 进程在运行时加载了哪些 gem 和插件? [英] Is there any way to tell which gems and plugins are loaded at runtime for a Rails process?

查看:11
本文介绍了有没有办法告诉 Rails 进程在运行时加载了哪些 gem 和插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

debuggerruby-debug 中是否有任何命令可以获取内存中为 Rails 进程加载的所有 gem 和/或插件的列表?我知道只加载了require"gem,但我想快速查看运行时加载的内容.

Is there any command either in debugger or ruby-debug to get a list of all gems and/or plugins loaded in memory for a Rails process? I understand only the 'require' gems are loaded but I would like to quickly see what got loaded during runtime.

推荐答案

这应该让你通过 ruby​​gems 加载所有内容:

This should get you everything loaded through rubygems:

Gem.loaded_specs.keys

我不知道查看加载了哪些 Rails 插件的通用方法,您可以查看 Rails::Initializer (pre 3.0) & 的源代码弄清楚你的 rails 版本在做什么.希望您知道应该加载哪些插件&调试时可以从控制台确认.

I don't know of a universal way to see which rails plugins are loaded, you can look at the source for Rails::Initializer (pre 3.0) & figure out what your version of rails is doing. Hopefully you know which plugins should be loading & can confirm that from the console when debugging.

这篇关于有没有办法告诉 Rails 进程在运行时加载了哪些 gem 和插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆