class Forme::Wrapper::TableRow

  1. lib/forme/transformers/wrapper.rb
Superclass: Wrapper

Methods

Public Instance

  1. call

Public Instance methods

call (tag, input)

Wrap the input in tr and td tags.

[show source]
   # File lib/forme/transformers/wrapper.rb
33 def call(tag, input)
34   a = super.flatten
35   labels, other = a.partition{|e| e.is_a?(Tag) && e.type.to_s == 'label'}
36   if labels.length == 1
37     ltd = labels
38     rtd = other
39   else
40     ltd = a
41   end
42   input.tag(:tr, input.opts[:wrapper_attr], [input.tag(:td, {}, ltd), input.tag(:td, {}, rtd)])
43 end