Sha256: c8a701e7d866c12834087befae3142cede255ef3f1132d8909c2687d7816f776

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true
module SimpleForm
  module Inputs
    class StringInput < Base
      enable :placeholder, :maxlength, :minlength, :pattern

      def input(wrapper_options = nil)
        unless string?
          input_html_classes.unshift("string")
          input_html_options[:type] ||= input_type if html5?
        end

        merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

        @builder.text_field(attribute_name, merged_input_options)
      end

      private

      def string?
        input_type == :string
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form-4.0.1 lib/simple_form/inputs/string_input.rb
simple_form-4.0.0 lib/simple_form/inputs/string_input.rb
simple_form-3.5.1 lib/simple_form/inputs/string_input.rb