"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/ruport/formatter/text.rb" between
ruport-1.7.1.tar.gz and ruport-1.8.0.tar.gz

About: Ruport (Ruby Reports) is a simple, extensible reporting system built for Rubyists. It provides tools for data acquisition, database interaction, formatting, and parsing/munging.

text.rb  (ruport-1.7.1):text.rb  (ruport-1.8.0)
skipping to change at line 113 skipping to change at line 113
# #
# Defaults to numeric values being right justified, and other values being # Defaults to numeric values being right justified, and other values being
# left justified. Can be changed to support centering of output by # left justified. Can be changed to support centering of output by
# setting options.alignment to :center # setting options.alignment to :center
# #
# Uses fit_to_width to truncate the row if necessary. # Uses fit_to_width to truncate the row if necessary.
# #
def build_row(data = self.data) def build_row(data = self.data)
max_col_widths_for_row(data) unless options.max_col_width max_col_widths_for_row(data) unless options.max_col_width
data.enum_for(:each_with_index).inject(line=[]) { |s,e| data.enum_for(:each_with_index).inject(line=[]) { |_s,e|
field,index = e field,index = e
if options.alignment.eql? :center if options.alignment.eql? :center
line << field.to_s.center(options.max_col_width[index]) line << field.to_s.center(options.max_col_width[index])
else else
align = field.is_a?(Numeric) ? :rjust : :ljust align = field.is_a?(Numeric) ? :rjust : :ljust
line << field.to_s.send(align, options.max_col_width[index]) line << field.to_s.send(align, options.max_col_width[index])
end end
} }
output << fit_to_width("| #{line.join(' | ')} |\n") output << fit_to_width("| #{line.join(' | ')} |\n")
end end
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)