flexy-odf-report 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/odf-report/table.rb +5 -3
- data/odf-report.gemspec +1 -1
- metadata +1 -1
data/lib/odf-report/table.rb
CHANGED
@@ -27,13 +27,15 @@ class Table
|
|
27
27
|
# New version
|
28
28
|
#
|
29
29
|
# Adds column only if condition is not evaluated to false.
|
30
|
-
|
31
|
-
#
|
30
|
+
|
31
|
+
# If condition equals :skip_blank_fields and both, field
|
32
|
+
# is nil and no block is given then nothing is done (no
|
33
|
+
# column is added).
|
32
34
|
#
|
33
35
|
def add_column_if(condition, name, field=nil, &block)
|
34
36
|
if condition
|
35
37
|
# Only render the column if condition holds true...
|
36
|
-
if (field.nil? || field.strip.blank?) && condition == :skip_blank_fields
|
38
|
+
if (field.nil? || field.strip.blank?) && block.nil? && condition == :skip_blank_fields
|
37
39
|
# Do nothing!
|
38
40
|
elsif field
|
39
41
|
@fields[name] = lambda { |item| item.send(field)}
|
data/odf-report.gemspec
CHANGED
@@ -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
|
+
s.version = "0.1.3"
|
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"]
|