I have an Array of Strings and I want to select only these Strings which are paths to files:
My path is "~/dlds/some_file.ics"
where ~/dlds
is a symlink to ~/archive/downloads
on my system. The file has following permissions:
-rw-r--r--
My code (I tried several variants):
ARGV.select do |string|
File.file? string # returns false
Pathname.new(string).file? # returns false
Pathname.new(string).expand_path.file? # returns false
end
I don't know what else to try.
I'm running Ruby 2.2.0 or 2.2.2.
File.exist? File.expand_path "~/dlds/some_file.ics"