lib/net/ldap/dn.rb in net-ldap-0.15.0 vs lib/net/ldap/dn.rb in net-ldap-0.16.0
- old
+ new
@@ -167,14 +167,13 @@
else raise "Fell out of state machine"
end
end
# Last pair
- if [:value, :value_normal, :value_hexstring, :value_end].include? state
- yield key.string.strip, value.string.rstrip
- else
- raise "DN badly formed"
- end
+ raise "DN badly formed" unless
+ [:value, :value_normal, :value_hexstring, :value_end].include? state
+
+ yield key.string.strip, value.string.rstrip
end
##
# Returns the DN as an array in the form expected by the constructor.
def to_a