From ac5784368fb23260abd4050a48c4443017c87bfc Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Fri, 6 Oct 2017 10:57:00 -0700 Subject: Sync up hard coded DN class in migration --- .../normalize_ldap_extern_uids_range.rb | 48 +++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3