summaryrefslogtreecommitdiffstats
path: root/lib/redmine/export/csv.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-03-17 06:10:53 +0000
committerGo MAEDA <maeda@farend.jp>2019-03-17 06:10:53 +0000
commit72a163d8b30978f23059ba2a2083675a38bd5680 (patch)
treeac2925ee1e6ee462a01519d319f750631efed6e1 /lib/redmine/export/csv.rb
parent53a6b06578d95f2eb241675d265d50fde87525d5 (diff)
downloadredmine-72a163d8b30978f23059ba2a2083675a38bd5680.tar.gz
redmine-72a163d8b30978f23059ba2a2083675a38bd5680.zip
Support frozen_string_literal in lib/redmine/export/*.rb (#26561).
Contributed by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17985 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/export/csv.rb')
-rw-r--r--lib/redmine/export/csv.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/redmine/export/csv.rb b/lib/redmine/export/csv.rb
index d85b7925a..9df6cf29c 100644
--- a/lib/redmine/export/csv.rb
+++ b/lib/redmine/export/csv.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
@@ -35,11 +35,12 @@ module Redmine
col_sep = l(:general_csv_separator)
encoding = Encoding.find(options[:encoding]) rescue Encoding.find(l(:general_csv_encoding))
- str = ''.force_encoding(encoding)
- if encoding == Encoding::UTF_8
- # BOM
- str = "\xEF\xBB\xBF".force_encoding(encoding)
- end
+ str =
+ if encoding == Encoding::UTF_8
+ +"\xEF\xBB\xBF" # BOM
+ else
+ (+'').force_encoding(encoding)
+ end
super(str, :col_sep => col_sep, :encoding => encoding, &block)
end