Sha256: 0dbd9bf5558ff9003a388fec67fc9d7aadc6cb663ae780d18ffa5e3634fdb61f
Contents?: true
Size: 999 Bytes
Versions: 6
Compression:
Stored size: 999 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 == '/' || parent_dir_path.include?(':/') ? paths : get_parent_directory_paths(parent_dir_path, paths) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems