Permalink
Browse files

ignore nil value in Memcached options

  • Loading branch information...
1 parent 5ee0dc9 commit 6b4bcc46325aeff1935059141bdd8042032e2c1d @flyerhzm flyerhzm committed Nov 10, 2012
View
@@ -25,6 +25,10 @@
it "should raise error with unsupported option distribution" do
lambda { Memcached.new("127.0.0.1:11211", :distribution => :unknown) }.should raise_error(Memcached::NotSupport)
end
+
+ it "should ignore nil value" do
+ lambda { Memcached.new("127.0.0.1:11211", :prefix => nil) }.should_not raise_error
+ end
end
context "set/get" do
@@ -63,7 +63,9 @@ public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
if (args.length > 1) {
RubyHash arguments = args[1].convertToHash();
for (Object key : arguments.keySet()) {
- options.put(key.toString(), arguments.get(key).toString());
+ if (arguments.get(key) != null) {
+ options.put(key.toString(), arguments.get(key).toString());
+ }
}
}
List<String> servers = new ArrayList<String>();
Binary file not shown.

0 comments on commit 6b4bcc4

Please sign in to comment.