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, line 32
def call(tag, input)
  a = super.flatten
  labels, other = a.partition{|e| e.is_a?(Tag) && e.type.to_s == 'label'}
  if labels.length == 1
    ltd = labels
    rtd = other
  else
    ltd = a
  end
  input.tag(:tr, input.opts[:wrapper_attr], [input.tag(:td, {}, ltd), input.tag(:td, {}, rtd)])
end