Auto correct rubocop style issues

This commit is contained in:
Patrick Gansterer 2022-02-20 16:15:22 +01:00
parent f260e607bf
commit 7e8c1d041d
39 changed files with 115 additions and 199 deletions

View file

@ -158,7 +158,7 @@ class FoodsoftConfig
# @return [Array<String>] Valid names of foodcoops.
def foodcoops
if config[:multi_coop_install]
APP_CONFIG.keys.reject { |coop| coop =~ /^(default|development|test|production)$/ }
APP_CONFIG.keys.grep_v(/^(default|development|test|production)$/)
else
[config[:default_scope]]
end
@ -189,7 +189,7 @@ class FoodsoftConfig
# @return [Hash] Full configuration.
def to_hash
keys.map { |k| [k, self[k]] }.to_h
keys.to_h { |k| [k, self[k]] }
end
# for using active_model_serializer in the api/v1/configs controller

View file

@ -25,6 +25,6 @@ class OrderTxt
# Helper method to test pdf via rails console: OrderTxt.new(order).save_tmp
def save_tmp
File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.txt", 'w') { |f| f.write(to_csv.force_encoding("UTF-8")) }
File.write("#{Rails.root}/tmp/#{self.class.to_s.underscore}.txt", to_csv.force_encoding("UTF-8"))
end
end

View file

@ -34,7 +34,7 @@ class RenderCSV
# Helper method to test pdf via rails console: OrderCsv.new(order).save_tmp
def save_tmp
encoding = @options[:encoding] || 'UTF-8'
File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.csv", 'w') { |f| f.write(to_csv.force_encoding(encoding)) }
File.write("#{Rails.root}/tmp/#{self.class.to_s.underscore}.csv", to_csv.force_encoding(encoding))
end
# XXX disable unit to avoid encoding problems, both in unit and whitespace. Also allows computations in spreadsheet.

View file

@ -120,7 +120,7 @@ class RenderPDF < Prawn::Document
# Helper method to test pdf via rails console: OrderByGroups.new(order).save_tmp
def save_tmp
File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", 'w') { |f| f.write(to_pdf.force_encoding("UTF-8")) }
File.write("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", to_pdf.force_encoding("UTF-8"))
end
# @todo avoid underscore instead of unicode whitespace in pdf :/