entry.rb 606 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # Extends the 'net/ldap' class Net::LDAP::Entry
  3. # without overwriting methods.
  4. class Net::LDAP::Entry
  5. # Creates a duplicate of the internal Hash containing the
  6. # attributes of the entry.
  7. #
  8. # @see Net::LDAP::Entry#initialize
  9. # @see Net::LDAP::Entry#attribute_names
  10. #
  11. # @example get the Hash
  12. # entry.to_h
  13. # #=> {dn: ['...'], another_attribute: ['...', ...], ...}
  14. #
  15. # @return [Hash{Symbol=>Array<String>}] A duplicate of the internal Hash with the entries attributes.
  16. def to_h
  17. @myhash.dup
  18. end
  19. end