lib/decisive/template_handler.rb in decisive-0.5.0 vs lib/decisive/template_handler.rb in decisive-0.5.1
- old
+ new
@@ -118,23 +118,25 @@
Row.new(record, block).to_hash
end
end
class Row < Struct.new(:record, :block)
+ module Nothing; end
+
def to_hash
@hash = {}
instance_exec record, &block
@hash
end
private
- def column key, value=nil, &block
+ def column key, value=Nothing, &block
@hash[key] = if block_given?
block.call(record)
elsif value.is_a?(Symbol)
record.send(value)
- elsif value.nil?
+ elsif value == Nothing
record.send(key.parameterize.underscore.to_sym)
else
value
end.to_s
end