Class: Skylark::LDAP::DN
- Inherits:
-
Object
- Object
- Skylark::LDAP::DN
- Defined in:
- lib/skylark/ldap/dn.rb
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
-
#initialize(dn_string) ⇒ DN
constructor
A new instance of DN.
- #parse(dn_string) ⇒ Object
- #parse!(dn_string) ⇒ Object
Constructor Details
#initialize(dn_string) ⇒ DN
Returns a new instance of DN.
6 7 8 |
# File 'lib/skylark/ldap/dn.rb', line 6 def initialize(dn_string) parse!(dn_string) end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
4 5 6 |
# File 'lib/skylark/ldap/dn.rb', line 4 def names @names end |
Instance Method Details
#parse(dn_string) ⇒ Object
14 15 16 17 18 |
# File 'lib/skylark/ldap/dn.rb', line 14 def parse(dn_string) dn_string.scan(/(?<type>OU|CN|DC)=(?<data>[A-z][\w\ -]*),?/i).map do |match| {match.first => match.last} end end |
#parse!(dn_string) ⇒ Object
10 11 12 |
# File 'lib/skylark/ldap/dn.rb', line 10 def parse!(dn_string) @names = parse(dn_string) end |