Prev | Current Page 183 | Next

David Berube

"Practical Reporting with Ruby and Rails"

latex_escape : 'First 100 eBay Results'} &
#{total_items} &
\\#{average_price ? ('$%0.2f' % average_price) : ''}
\\\\ "
# Note that the character & is the marker for the end of a cell, and
# that the sequence \\\\ is two escaped backslashes, which marks
# the end of the row.
first=false # This marker controls whether to redisplay the keyword.
# For visual formatting reasons, each keyword is
# shown only once.
end
end
This code loops through each seller/keyword combination, searches eBay using the
get_average_price class, and prints out a single line of LaTeX for each combination. For
the first line for each keyword, it displays the keyword in bold; otherwise, you would have
a repeated cell value for every seller, which would be visually repetitive.
Note that the cells in your LaTeX row are separated by & characters, and that there??™s
a special case to handle sellers with a value of nil. The argument-handling part of the
script adds a nil to the end of the sellers array, so that for every keyword, an average
value of the first 100 eBay results??”regardless of who is selling the items??”will be displayed.


Pages:
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
szkolenia dla przedsiębiorców oferty spa Wczasy nad morzem projektowanie wnętrz opony michelin