Method: ActionView::Helpers::Tags::Base#initialize

Defined in:
actionview/lib/action_view/helpers/tags/base.rb

#initialize(object_name, method_name, template_object, options = {}) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'actionview/lib/action_view/helpers/tags/base.rb', line 11

def initialize(object_name, method_name, template_object, options = {})
  @object_name, @method_name = object_name.to_s.dup, method_name.to_s.dup
  @template_object = template_object

  @object_name.sub!(/\[\]$/, "") || @object_name.sub!(/\[\]\]$/, "]")
  @object = retrieve_object(options.delete(:object))
  @skip_default_ids = options.delete(:skip_default_ids)
  @allow_method_names_outside_object = options.delete(:allow_method_names_outside_object)
  @options = options

  if Regexp.last_match
    @generate_indexed_names = true
    @auto_index = retrieve_autoindex(Regexp.last_match.pre_match)
  else
    @generate_indexed_names = false
    @auto_index = nil
  end
end