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

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

问题描述

调试器 ruby​​-debug 中是否有任何命令可以获取所有宝石和/或插件加载在内存中用于Rails进程?我理解只有'需要'宝石被加载,但我想快速看到在运行时加载什么。

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.

推荐答案

这应该让你通过rubygems加载的所有东西:

This should get you everything loaded through rubygems:

Gem.loaded_specs.keys

我不知道通用的方式来查看哪个rails插件加载,你可以看看Rails :: Initializer(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进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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