@@ -878,13 +878,7 @@ public Collection<RubySymbol> filterMethods(RubyLanguage language, boolean inclu
878
878
if (includeAncestors ) {
879
879
allMethods = ModuleOperations .getAllMethods (rubyModule );
880
880
} else {
881
- Map <String , InternalMethod > results = new HashMap <>();
882
- for (Entry <String , MethodEntry > e : methods .entrySet ()) {
883
- if (e .getValue ().getMethod () != null ) {
884
- results .put (e .getKey (), e .getValue ().getMethod ());
885
- }
886
- }
887
- allMethods = results ;
881
+ allMethods = getInternalMethodMap ();
888
882
}
889
883
return filterMethods (language , allMethods , filter );
890
884
}
@@ -910,13 +904,7 @@ public Collection<RubySymbol> filterSingletonMethods(
910
904
if (includeAncestors ) {
911
905
allMethods = ModuleOperations .getMethodsBeforeLogicalClass (rubyModule );
912
906
} else {
913
- Map <String , InternalMethod > results = new HashMap <>();
914
- for (Entry <String , MethodEntry > e : methods .entrySet ()) {
915
- if (e .getValue ().getMethod () != null ) {
916
- results .put (e .getKey (), e .getValue ().getMethod ());
917
- }
918
- }
919
- allMethods = results ;
907
+ allMethods = getInternalMethodMap ();
920
908
}
921
909
return filterMethods (language , allMethods , filter );
922
910
}
@@ -937,6 +925,16 @@ public Collection<RubySymbol> filterMethods(
937
925
return filtered ;
938
926
}
939
927
928
+ private Map <String , InternalMethod > getInternalMethodMap () {
929
+ Map <String , InternalMethod > map = new HashMap <>();
930
+ for (Entry <String , MethodEntry > e : methods .entrySet ()) {
931
+ if (e .getValue ().getMethod () != null ) {
932
+ map .put (e .getKey (), e .getValue ().getMethod ());
933
+ }
934
+ }
935
+ return map ;
936
+ }
937
+
940
938
public RubyClass getLogicalClass () {
941
939
return rubyModule .getLogicalClass ();
942
940
}
0 commit comments