Sha256: a5efcd4a67bf90537cac3bcb8415ed0afb581c3908953ae2ecbe989ef5a223d4

Contents?: true

Size: 568 Bytes

Versions: 18

Compression:

Stored size: 568 Bytes

Contents

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
          content = input.send(namespace)
          wrap(input, options, content) if content
        end
      end

      private

      def html_options(options)
        [:label, :input].include?(namespace) ? {} : super
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
simple_form-3.0.4 lib/simple_form/wrappers/single.rb
simple_form-2.1.3 lib/simple_form/wrappers/single.rb
simple_form-2.1.2 lib/simple_form/wrappers/single.rb
simple_form-3.0.3 lib/simple_form/wrappers/single.rb
simple_form-3.0.2 lib/simple_form/wrappers/single.rb
simple_form-3.0.1 lib/simple_form/wrappers/single.rb
simple_form-2.1.1 lib/simple_form/wrappers/single.rb
simple_form-3.0.0 lib/simple_form/wrappers/single.rb
simple_form_awesome-2.5.0 lib/simple_form/wrappers/single.rb
simple_form_awesome-2.4.0 lib/simple_form/wrappers/single.rb
simple_form_awesome-2.3.0 lib/simple_form/wrappers/single.rb
simple_form_awesome-2.2.0 lib/simple_form/wrappers/single.rb
simple_form-3.0.0.rc lib/simple_form/wrappers/single.rb
simple_form-2.1.0 lib/simple_form/wrappers/single.rb
simple_form-3.0.0.beta1 lib/simple_form/wrappers/single.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.4/lib/simple_form/wrappers/single.rb
simple_form-2.0.4 lib/simple_form/wrappers/single.rb
simple_form-2.0.3 lib/simple_form/wrappers/single.rb