Sha256: 3d01e4ddda2b384166abb063e3e82aac0a8f2e31dd2812be1ceba7f607d852be

Contents?: true

Size: 849 Bytes

Versions: 47

Compression:

Stored size: 849 Bytes

Contents

module DynamicScaffold
  module Form
    module Item
      class TwoOptions < Base
        def initialize(config, type, *args)
          name = args.shift
          # rubocop:disable Style/IdenticalConditionalBranches
          if args[args.length - 2].is_a?(Hash)
            html_attributes = args.extract_options!
            @options = args.extract_options!
          else
            html_attributes = {}
            @options = args.extract_options!
          end
          # rubocop:enable Style/IdenticalConditionalBranches

          @args = args
          super(config, type, name, html_attributes)
        end

        def render(_view, form, classnames = nil)
          html_attributes = build_html_attributes(classnames)
          form.public_send(@type, @name, *@args, @options, html_attributes)
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
dynamic_scaffold-0.10.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.10.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.9.2 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.9.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.9.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.5 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.4 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.3 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.2 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.8.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.7.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.7.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.6.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.6.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.5.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.4.2 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.4.1 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.4.0 lib/dynamic_scaffold/form/item/two_options.rb
dynamic_scaffold-0.3.1 lib/dynamic_scaffold/form/item/two_options.rb