Thursday, 17 July 2014

ancestors and descendants

#ancestors
Class.ancestors
=> [Class, Module, ActiveSupport::Dependencies::ModuleConstMissing, Object, Netfira::WebConnect, ActiveSupport::Dependencies::Loadable, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]
#descendants
ObjectSpace.each_object(Class) do |klass|
p klass if klass < StandardError
end
String.subclasses
#=> [SQLite3::Blob, ActiveSupport::JSON::Encoding::JSONGemEncoder::EscapedString, Arel::Nodes::SqlLiteral]
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment