module Where class </ $1 ) end def are_via_extractor(extractor, klass, method_name) methods = klass.ancestors.map do |ancestor| method = ancestor.send(extractor, method_name) if method.owner == ancestor source_location(method) else nil end end methods.compact! methods end def defined_methods(klass) methods = klass.methods(false).map{|m| klass.method(m)} + klass.instance_methods(false).map{|m| klass.instance_method(m)} methods.map!(&:source_location) methods.compact! methods end end TextMateEditor = lambda do |file, line| `mate "#{file}" -l #{line}` end NoEditor = lambda do |file, line| end @editor = TextMateEditor end def where_is(klass, method = nil) Where.edit(if method begin Where.is_instance_method(klass, method) rescue NameError Where.is_method(klass, method) end else Where.is_class_primarily(klass) end) end if __FILE__ == $0 class World def self.carmen end end where_is(World, :carmen) end