Module: RailsRoutesAnalyzer::GemManager

Extended by:
GemManager
Included in:
GemManager
Defined in:
lib/rails_routes_analyzer/gem_manager.rb

Instance Method Summary collapse

Instance Method Details

#clean_gem_path(location) ⇒ String

Replaces gem locations in file paths with the name of the gem.

Parameters:

  • location (String)

    full path to a ruby source file.

Returns:

  • (String)

    path to ruby source file with gem location replaced.



9
10
11
12
13
# File 'lib/rails_routes_analyzer/gem_manager.rb', line 9

def clean_gem_path(location)
  location.gsub(gem_path_prefix_cleanup_regex) do |val|
    gem_path_prefix_replacements[val] || val
  end
end

#identify_gem(location) ⇒ String

Identifies a gem based on a location from a backtrace.

Parameters:

  • location (String)

    full path to a source file possibly in a gem.

Returns:

  • (String)

    name of a gem.



19
20
21
# File 'lib/rails_routes_analyzer/gem_manager.rb', line 19

def identify_gem(location)
  gem_locations[location[gem_locations_regexp]]
end