Method: DataPaths::Finders#each_data_path

Defined in:
lib/data_paths/finders.rb

#each_data_path(path) {|potential_path| ... } ⇒ Enumerator

Passes all existing data paths for the specified path, within the data directories, to the given block.

Parameters:

  • path (String)

    The path to search for in all data directories.

Yields:

  • (potential_path)

    The given block will be passed every existing combination of the given path and the data directories.

Yield Parameters:

  • potential_path (String)

    An existing data path.

Returns:

  • (Enumerator)

    If no block is given, an Enumerator object will be returned.



24
25
26
27
28
29
30
31
32
# File 'lib/data_paths/finders.rb', line 24

def each_data_path(path)
  return enum_for(:each_data_path,path) unless block_given?

  DataPaths.paths.each do |dir|
    full_path = File.join(dir,path)

    yield(full_path) if File.exists?(full_path)
  end
end