Module: Evilution::RailsDetector Private

Defined in:
lib/evilution/rails_detector.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

MARKER =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

File.join("config", "application.rb").freeze

Class Method Summary collapse

Class Method Details

.rails_root_for(path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evilution/rails_detector.rb', line 10

def rails_root_for(path)
  return nil if path.nil?

  dir = starting_dir(path)
  return nil if dir.nil?

  @mutex.synchronize do
    return @cache[dir] if @cache.key?(dir)

    @cache[dir] = walk_up(dir)
  end
end

.rails_root_for_any(paths) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
# File 'lib/evilution/rails_detector.rb', line 23

def rails_root_for_any(paths)
  Array(paths).each do |path|
    root = rails_root_for(path)
    return root if root
  end
  nil
end

.reset_cache!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/evilution/rails_detector.rb', line 31

def reset_cache!
  @mutex.synchronize { @cache.clear }
end