lib/net/dns/resolver/timeouts.rb in net-dns-0.9.0 vs lib/net/dns/resolver/timeouts.rb in net-dns-0.20.0
- old
+ new
@@ -5,14 +5,12 @@
class Resolver
class DnsTimeout
attr_reader :seconds
def initialize(seconds)
- if seconds.is_a?(Numeric) && seconds >= 0
- @seconds = seconds
- else
- raise ArgumentError, "Invalid value for tcp timeout"
- end
+ raise ArgumentError, "Invalid value for tcp timeout" unless seconds.is_a?(Numeric) && seconds >= 0
+
+ @seconds = seconds
end
# Returns a string representation of the timeout corresponding
# to the number of <tt>@seconds</tt>.
def to_s