lib/trestle/table/column.rb in trestle-0.8.10 vs lib/trestle/table/column.rb in trestle-0.8.11

- old
+ new

@@ -47,9 +47,27 @@ def render(instance) @template.content_tag(:td, content(instance), class: classes, data: data) end + def render? + if options.key?(:if) + if options[:if].respond_to?(:call) + @template.instance_exec(&options[:if]) + else + options[:if] + end + elsif options.key?(:unless) + if options[:unless].respond_to?(:call) + !@template.instance_exec(&options[:unless]) + else + !options[:unless] + end + else + true + end + end + def header return if options.key?(:header) && options[:header].in?([nil, false]) header = @column.header header = @template.instance_exec(&header) if header.respond_to?(:call)