class DynamicScaffold::Form::Item::TwoOptions

Public Class Methods

new(config, type, *args) click to toggle source
Calls superclass method DynamicScaffold::Form::Item::Base::new
# File lib/dynamic_scaffold/form/item/two_options.rb, line 5
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

Public Instance Methods

render(view, form, classnames = nil) click to toggle source
# File lib/dynamic_scaffold/form/item/two_options.rb, line 21
def render(view, form, classnames = nil)
  html_attributes = build_html_attributes(classnames)
  form.public_send(@type, @name, *build_args(view, @args), @options, html_attributes)
end