From 15cd0f840ddd736cefac02814a581f8e11c1764d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 29 Oct 2013 01:10:26 +0000 Subject: config: reject negative float for client_expire_ratio Negative ratio makes little sense and there's no reason to allow it. --- lib/yahns/config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/yahns/config.rb') diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 88af2de..c923434 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -278,7 +278,8 @@ class Yahns::Config # :nodoc: var = _check_in_block(nil, :client_expire_threshold) case val when Float - val <= 1.0 or raise ArgumentError, "#{var} must be <= 1.0 if a ratio" + (val > 0 && val <= 1.0) or + raise ArgumentError, "#{var} must be > 0 and <= 1.0 if a ratio" when Integer else raise ArgumentError, "#{var} must be a float or integer" -- cgit v1.2.3-24-ge0c7