flexy-odf-report 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,10 +32,23 @@ class Table
32
32
  ret = []
33
33
  collection.each do |item|
34
34
  row = {}
35
- @fields.each do |field_name, block1|
36
- cell = block1.call(item) || ''
37
- row[field_name] = cell unless (cell.nil? || cell.strip.blank?) && @skip_empty_rows
35
+
36
+ force_fill_with_empty_string = false
37
+ 2.times.each do
38
+ @fields.each do |field_name, block1|
39
+ cell = block1.call(item) || ''
40
+ row[field_name] = cell unless !force_fill_with_empty_string && (cell.nil? || cell.strip.blank?) && @skip_empty_rows
41
+ end
42
+ if row.empty?
43
+ break
44
+ else
45
+ # If - finally - the row is *not* empty all template variables in
46
+ # all empty cells must be replaced by the empty string. Otherwise
47
+ # the template variable is rendered ("[some-template-var]")...
48
+ force_fill_with_empty_string = true
49
+ end
38
50
  end
51
+
39
52
  ret << row unless row.empty? && @skip_empty_rows
40
53
  end
41
54
  ret
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{flexy-odf-report}
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sandro Duarte", "Mark von Zeschau"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: flexy-odf-report
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sandro Duarte