Sha256: 5aa30e191d63de421e38ec459e693612b161bfd2b950f962cd7c7dd8533a576c
Contents?: true
Size: 646 Bytes
Versions: 6
Compression:
Stored size: 646 Bytes
Contents
require 'dnc' # # Extend the core String class to include `.to_dn` && `.to_dn!` # class String # Parses the string to return a DN object # Returns nil if a DN instance cannot be created def to_dn begin new_dn = DN.new(dn_string: to_s) rescue StandardError new_dn = nil end new_dn end # Similar to {#to_dn}, but raises an error unless the string can be # explicitly parsed to a DN instance def to_dn! begin new_dn = DN.new(dn_string: to_s) rescue StandardError raise DnStringUnparsableError, "Could not force conversion to DN:\n#{inspect}" end new_dn end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
dnc-0.1.5 | lib/dnc/string.rb |
dnc-0.1.4 | lib/dnc/string.rb |
dnc-0.1.3 | lib/dnc/string.rb |
dnc-0.1.2 | lib/dnc/string.rb |
dnc-0.1.1 | lib/dnc/string.rb |
dnc-0.1 | lib/dnc/string.rb |