diff options
Diffstat (limited to 'lib/gitlab/blob_helper.rb')
-rw-r--r-- | lib/gitlab/blob_helper.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/gitlab/blob_helper.rb b/lib/gitlab/blob_helper.rb index 57d632afd74..c5b183d113d 100644 --- a/lib/gitlab/blob_helper.rb +++ b/lib/gitlab/blob_helper.rb @@ -38,7 +38,7 @@ module Gitlab # If Charlock says its binary else - detect_encoding[:type] == :binary + find_encoding[:type] == :binary end end @@ -137,23 +137,25 @@ module Gitlab end def ruby_encoding - if hash = detect_encoding + if hash = find_encoding hash[:ruby_encoding] end end def encoding - if hash = detect_encoding + if hash = find_encoding hash[:encoding] end end - def detect_encoding - @detect_encoding ||= CharlockHolmes::EncodingDetector.new.detect(data) if data # rubocop:disable Gitlab/ModuleWithInstanceVariables - end - def empty? data.nil? || data == "" end + + private + + def find_encoding + @find_encoding ||= Gitlab::EncodingHelper.detect_encoding(data) if data # rubocop:disable Gitlab/ModuleWithInstanceVariables + end end end |