Module: DependencyGrapher::GetKnownClasses
- Defined in:
- lib/dependency_grapher/get_known_classes.rb
Class Method Summary collapse
Class Method Details
.call(folder = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dependency_grapher/get_known_classes.rb', line 6 def call(folder = nil) result = Set.new #ActiveSupport::Dependencies.autoload_paths.each do |folder| if folder full_folder = "app/" + folder.to_s result = get_classes_in(full_folder) else Rails.application.config.eager_load_paths.each do |folder| result.merge get_classes_in(folder) end end result end |
.get_classes_in(folder) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/dependency_grapher/get_known_classes.rb', line 21 def get_classes_in(folder) classes = Set.new files = File.join("#{folder}", "**", "*.rb") Dir.glob(files).map do |file| classes << file[/#{folder}\/(.*).rb/,1].camelize end classes end |