diff options
-rw-r--r-- | lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb index cf7eafcff3b..bc53e6d7f94 100644 --- a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb +++ b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb @@ -37,26 +37,6 @@ module Gitlab end end - def initialize_array(args) - buffer = StringIO.new - - args.each_with_index do |arg, index| - if index.even? # key - buffer << "," if index > 0 - buffer << arg - else # value - buffer << "=" - buffer << self.class.escape(arg) - end - end - - @dn = buffer.string - end - - def initialize_string(arg) - @dn = arg.to_s - end - ## # Parse a DN into key value pairs using ASN from # http://tools.ietf.org/html/rfc2253 section 3. @@ -270,6 +250,28 @@ module Gitlab escaped.gsub(HEX_ESCAPE_RE) { |char| HEX_ESCAPES[char] } end + private + + def initialize_array(args) + buffer = StringIO.new + + args.each_with_index do |arg, index| + if index.even? # key + buffer << "," if index > 0 + buffer << arg + else # value + buffer << "=" + buffer << self.class.escape(arg) + end + end + + @dn = buffer.string + end + + def initialize_string(arg) + @dn = arg.to_s + end + ## # Proxy all other requests to the string object, because a DN is mainly # used within the library as a string @@ -277,6 +279,12 @@ module Gitlab def method_missing(method, *args, &block) @dn.send(method, *args, &block) end + + ## + # Redefined to be consistent with redefined `method_missing` behavior + def respond_to?(sym, include_private = false) + @dn.respond_to?(sym, include_private) + end end end end |