Method: Act::Command#infer_local_path

Defined in:
lib/act/command.rb

#infer_local_path(path) ⇒ String, Nil

Returns:

  • (String, Nil)


96
97
98
99
100
101
102
103
104
105
# File 'lib/act/command.rb', line 96

def infer_local_path(path)
  path_components = Pathname(path).each_filename.to_a
  until path_components.empty?
    path_components.shift
    candidate = File.join(path_components)
    if File.exist?(candidate)
      return candidate
    end
  end
end