1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/lib/simple_form/wrappers/single.rb
Carlos Antonio da Silva 57066de948 Whitespace :scissors
2012-01-19 23:25:43 -02:00

20 lines
479 B
Ruby

module SimpleForm
module Wrappers
# `Single` is an optimization for a wrapper that has only one component.
class Single < Many
def initialize(name, options={})
super(name, [name], options)
end
def render(input)
options = input.options
if options[namespace] == false
nil
else
content = input.send(namespace)
wrap(input, options, content) if content
end
end
end
end
end