remove nil predicate
authorKatelyn Schiesser <kschiesser@laika.com>
Thu, 18 Apr 2019 12:11:01 -0700
changeset 22 d36032444b99
parent 21 58e70e52f817
child 23 a363d4d5a895
remove nil predicate
lib/arborist/monitor/snmp/ups/battery.rb
--- a/lib/arborist/monitor/snmp/ups/battery.rb	Thu Apr 18 11:59:38 2019 -0700
+++ b/lib/arborist/monitor/snmp/ups/battery.rb	Thu Apr 18 12:11:01 2019 -0700
@@ -86,11 +86,11 @@
 
 		# don't report voltage if the UPS doesn't
 		voltage = snmp.get( oid: OIDS[:battery_voltage] ) rescue nil
-		info[ :voltage ] = voltage / 10 unless voltage.nil?
+		info[ :voltage ] = voltage / 10 if voltage
 
 		# don't report current if the UPS doesn't
 		current = snmp.get( oid: OIDS[:battery_current] ) rescue nil
-		info[ :current ] = current/10 unless current.nil?
+		info[ :current ] = current/10 if current
 
 		# see if we are on battery
 		info[ :seconds_on_battery ] = snmp.get( oid: OIDS[:seconds_on_battery] ) rescue 0