diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-01-23 17:44:26 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-01-23 17:46:17 -0800 |
commit | b4ca5228ec024bdcbb98fcdb883738941fe0d1fd (patch) | |
tree | c63db5a6844861c8c0b4a4b6e68e985bd688f973 /lib/mogilefs/mogilefs.rb | |
parent | b294f73c1686be08b9a2509c74ad4fc28151050a (diff) | |
download | mogilefs-client-b4ca5228ec024bdcbb98fcdb883738941fe0d1fd.tar.gz |
Don't specify an empty class (e.g. "class="), instead just omit the parameter entirely if it is nil.
Diffstat (limited to 'lib/mogilefs/mogilefs.rb')
-rw-r--r-- | lib/mogilefs/mogilefs.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/mogilefs/mogilefs.rb b/lib/mogilefs/mogilefs.rb index ee5cc37..e1c8aed 100644 --- a/lib/mogilefs/mogilefs.rb +++ b/lib/mogilefs/mogilefs.rb @@ -101,11 +101,11 @@ class MogileFS::MogileFS < MogileFS::Client # # The +block+ operates like File.open. - def new_file(key, klass, bytes = 0, &block) # :yields: file + def new_file(key, klass = nil, bytes = 0, &block) # :yields: file raise MogileFS::ReadOnlyError if readonly? - - res = @backend.create_open(:domain => @domain, :class => klass, - :key => key, :multi_dest => 1) + opts = { :domain => @domain, :key => key, :multi_dest => 1 } + opts[:class] = klass if klass + res = @backend.create_open(opts) dests = if dev_count = res['dev_count'] # multi_dest succeeded (1..dev_count.to_i).map do |i| |