Skip to content

Commit

Permalink
added Mogilefs#exist?
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Nov 22, 2008
1 parent 36fdb97 commit 8ae8f00
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/thumbo/storages/mogilefs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def delete filename

end

# raises MogileFS::Backend::UnknownKeyError
def paths filename
client.get_paths(filename)

Expand All @@ -46,6 +45,14 @@ def paths filename

end

def exist? filename
target = paths(filename)
target[ rand(target.size) ]

rescue Thumbo::FileNotFound
false
end

def client
@client ||=
MogileFS::MogileFS.new( :domain => domain,
Expand Down

0 comments on commit 8ae8f00

Please sign in to comment.