refactoring - How can I detect which modules depend on which modules in Ruby? -
what tools can determine modules have methods calling methods other modules in ruby?
background: i'm partway through breaking 808 line module smaller modules, having created 12-submodules. however, of methods in 1 of modules calling methods in sub-module. may or may not ok, depending on whether module of called method meant common functionality.
module displaystatistics1 def display_statistics_1_foo calculate_statistics_foo # call method that's in calculatestatistics - ok display_statistics_2_bar # call method that's in displaystatistics2 - bad end # other methods omitted end # modules displaystatistics2 , calculatestatistics omitted class exampleclass include displaystatistics1 include displaystatistics2 include calculatestatistics end
ideally analysis tool show displaystatistics1
has dependencies on displaystatistics2
on calculatestatistics
.
update: maybe shouldn't have done way - maybe should have split them classes instead. way, i'd have known sure depended on what!
while i'm not aware of static analysis tool ruby, 1 seems closest want rubyprof. can generate callgraph in many formats, including html tree , graphviz box-and-line plot.
Comments
Post a Comment