summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEtienne Massip <etienne.massip@gmail.com>2013-04-02 17:37:52 +0000
committerEtienne Massip <etienne.massip@gmail.com>2013-04-02 17:37:52 +0000
commit4224a0c3feebda795190dedb8e61521dee2e8ffe (patch)
tree08c0cc4876c0c7031745d57c510fb446f73bbda7 /lib
parent4a3864a1801586d68b4bf4c87edd0113c44af2f2 (diff)
downloadredmine-4224a0c3feebda795190dedb8e61521dee2e8ffe.tar.gz
redmine-4224a0c3feebda795190dedb8e61521dee2e8ffe.zip
Code cleanup (#13630).
Contributed by F Schroedter. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11694 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/pdf.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index 139416798..5632838e7 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -314,11 +314,11 @@ module Redmine
col_width_avg.map! {|x| x / k}
# calculate columns width
- ratio = table_width / col_width_avg.inject(0) {|s,w| s += w}
+ ratio = table_width / col_width_avg.inject(0, :+)
col_width = col_width_avg.map {|w| w * ratio}
# correct max word width if too many columns
- ratio = table_width / word_width_max.inject(0) {|s,w| s += w}
+ ratio = table_width / word_width_max.inject(0, :+)
word_width_max.map! {|v| v * ratio} if ratio < 1
# correct and lock width of some columns
@@ -354,7 +354,7 @@ module Redmine
# calculate column normalizing ratio
if free_col_width == 0
- ratio = table_width / col_width.inject(0) {|s,w| s += w}
+ ratio = table_width / col_width.inject(0, :+)
else
ratio = (table_width - fix_col_width) / free_col_width
end
@@ -426,13 +426,13 @@ module Redmine
col_width = []
unless query.inline_columns.empty?
col_width = calc_col_width(issues, query, table_width, pdf)
- table_width = col_width.inject(0) {|s,v| s += v}
+ table_width = col_width.inject(0, :+)
end
# use full width if the description is displayed
if table_width > 0 && query.has_column?(:description)
col_width = col_width.map {|w| w * (page_width - right_margin - left_margin) / table_width}
- table_width = col_width.inject(0) {|s,v| s += v}
+ table_width = col_width.inject(0, :+)
end
# title
@@ -493,8 +493,7 @@ module Redmine
end
# Renders MultiCells and returns the maximum height used
- def issues_to_pdf_write_cells(pdf, col_values, col_widths,
- row_height, head=false)
+ def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
base_y = pdf.GetY
max_height = row_height
col_values.each_with_index do |column, i|