Sha256: 0ee8975ec026fa4e16f6fbd41c5c514468e23b0c9e1d092c389760eac4b22006
Contents?: true
Size: 965 Bytes
Versions: 27
Compression:
Stored size: 965 Bytes
Contents
module Fulmar module Service # Provides internal helper methods class HelperService class << self ## # Reverse file lookup in path # @param path [String] # @param filename [String] def reverse_file_lookup(path, filename) paths = get_parent_directory_paths(path) paths.each do |directory| file_path = directory + '/' + filename return file_path if File.exist? file_path end false end private ## # Get paths of each parent directory # @param path [String] # @param paths [Array] # @return [Array] A list of paths def get_parent_directory_paths(path, paths = []) paths << path parent_dir_path = File.expand_path('..', path) parent_dir_path == '/' ? paths : get_parent_directory_paths(parent_dir_path, paths) end end end end end
Version data entries
27 entries across 27 versions & 1 rubygems