Permalink
Browse files

Merge pull request #7 from alexander-sysuiev/master

Label takes lambda as input
  • Loading branch information...
2 parents ef6d22e + d3f9233 commit 42ecc49da02cabcac42515d6f61964a73b3149a1 @alexander-sysuiev alexander-sysuiev committed Jan 19, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −2 lib/tabloid/data.rb
  2. +1 −2 lib/tabloid/report.rb
View
@@ -9,11 +9,11 @@ def initialize(options = {})
@report_columns = options[:report_columns]
@grouping_key = options[:grouping_key]
- @grouping_options = options[:grouping_options] || {}
+ @grouping_options = options[:grouping_options].try(:dup) || {}
@summary_options = options[:summary] || {}
@rows = convert_rows(options[:rows])
-
+ @grouping_options.delete(:label)
end
def to_csv
@@ -50,6 +50,7 @@ def groups_for(rows)
def label_for(key)
return false if key == :default
+
if @grouping_options[:label]
@grouping_options[:label].call(key)
else
@@ -92,7 +92,7 @@ module InstanceMethods
</div>
</body>
</html>
-EOS
+ EOS
def prepare(options={})
before_prepare if self.respond_to?(:before_prepare)
@@ -201,7 +201,6 @@ def cache_client
end
def build_and_cache_data
-
@data ||= begin
report_data = Tabloid::Data.new(
:report_columns => self.report_columns,

0 comments on commit 42ecc49

Please sign in to comment.