lib/hagma/events/summary.rb
# search method_info objects from the method name
# @param met [Symbol|String] method name
# @return [Hash] hash which key are class and value is MethodStat
search method_info objects from the method name
search method_info objects from the method name
def lookup_classes(met)
        new_klasses = @module_collection.keys
        res = Hash.new { |h, k| h[k] = [] }
        @method_collection.list.select { |method_info| method_info.name == met.to_sym }.map do |method_info|
          m_owner = method_info.owner
          res[m_owner] << MethodStat.new(method_info, ModuleInfo.root(m_owner), 0)
          owner_module_info = find_module_info(method_info)
          new_klasses.each do |klass|
            next if klass == method_info.owner
            if (idx = klass.ancestors.index(method_info.owner))
              raise ModuleNotFoundError if owner_module_info.nil?
              res[klass] << MethodStat.new(method_info, owner_module_info, idx - self.class.offset(klass))
            end
          end
        end
        res
      end
def lookup_classes ( met ) new_klasses = @module_collection . keys res = Hash . new { | h , k | h [ k ] = [ ] } @method_collection . list . select { | method_info | method_info . name == met . to_sym } . map do | method_info | m_owner = method_info . owner res [ m_owner ] << MethodStat . new ( method_info , ModuleInfo . root ( m_owner ) , 0 ) owner_module_info = find_module_info ( method_info ) new_klasses . each do | klass | next if klass == method_info . owner if ( idx = klass . ancestors . index ( method_info . owner ) ) raise ModuleNotFoundError if owner_module_info . nil? res [ klass ] << MethodStat . new ( method_info , owner_module_info , idx - self . class . offset ( klass ) ) end end end res end
search method_info objects from the method name
search method_info objects from the method name
# add method_info myself to res
hash which key are class and value is MethodStat
hash which key are class and value is MethodStat
Hash
met
None