ObjectSpace

Module: ObjectSpace

Class Method Summary

Class Method Details

.classes(&block) ⇒ Object

Returns all the classes in the object space. Optionally, a block can be passed, for example the following code would return the classes that start with the character “A”:

ObjectSpace.classes do |klass|
  if klass.to_s[0] == "A"
    klass
  end
end

.new_classes(snapshot) ⇒ Object

Returns a list of existing classes that are not included in “snapshot” This method is useful to get the list of new classes that were loaded after an event like requiring a file. Usage:

snapshot = ObjectSpace.classes
# require a file
ObjectSpace.new_classes(snapshot)

© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/ObjectSpace

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部