From: Toshi MARUYAMA Date: Sat, 16 Nov 2019 13:10:51 +0000 (+0000) Subject: rubocop: fix Lint/IneffectiveAccessModifier in app/models/auth_source_ldap.rb (#32470) X-Git-Tag: 4.2.0~1549 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bd00d16d0f5d10cdb4e60b069ca51866127767b7;p=redmine.git rubocop: fix Lint/IneffectiveAccessModifier in app/models/auth_source_ldap.rb (#32470) git-svn-id: http://svn.redmine.org/redmine/trunk@19085 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d4738691e..e91e986ef 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -390,10 +390,6 @@ Lint/HandleExceptions: - 'lib/redmine/scm/adapters/cvs_adapter.rb' - 'lib/redmine/scm/adapters/subversion_adapter.rb' -Lint/IneffectiveAccessModifier: - Exclude: - - 'app/models/auth_source_ldap.rb' - Lint/InterpolationCheck: Exclude: - 'app/models/user.rb' diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index 3c55bff75..aba76a6fc 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -244,10 +244,13 @@ class AuthSourceLdap < AuthSource attrs end - def self.get_attr(entry, attr_name) - if !attr_name.blank? - value = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] - value.to_s.force_encoding('UTF-8') + # Singleton class method is public + class << self + def get_attr(entry, attr_name) + if !attr_name.blank? + value = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] + value.to_s.force_encoding('UTF-8') + end end end end