D
David Stanford
Hi guys,
I'm looking for a single line that essentially deletes the lockfile
argument passed to the unlock method, or deletes the instance variable
(default) lockfile. Like this, but simpler:
@lockfile = some_other_lockfile
def self.unlock(lockfile)
if File.exist?(lockfile)
File.delete(lockfile)
else
File.delete(@lockfile)
end
end
I was thinking of something along the following:
@lockfile = some_other_lockfile
def self.unlock
File.delete(lockfile) || File.delete(@lockfile)
end
...however, the File.delete method doesn't return a true/false value
based on its success.
Any tips? Thanks in advance!
-David
I'm looking for a single line that essentially deletes the lockfile
argument passed to the unlock method, or deletes the instance variable
(default) lockfile. Like this, but simpler:
@lockfile = some_other_lockfile
def self.unlock(lockfile)
if File.exist?(lockfile)
File.delete(lockfile)
else
File.delete(@lockfile)
end
end
I was thinking of something along the following:
@lockfile = some_other_lockfile
def self.unlock
File.delete(lockfile) || File.delete(@lockfile)
end
...however, the File.delete method doesn't return a true/false value
based on its success.
Any tips? Thanks in advance!
-David