Flowdock
method

assign_method_name

Importance_0
v1.0.0 - Show latest stable - 0 notes - Class: ActionView::Base
assign_method_name(extension, template, file_name) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/base.rb, line 382
      def assign_method_name(extension, template, file_name)
        method_name = '_run_'

        if extension && (extension.to_sym == :rxml)
          method_name << 'xml_'
        else
          method_name << 'html_'
        end

        if file_name
          file_path = File.expand_path(file_name)
          base_path = File.expand_path(@base_path)

          i = file_path.index(base_path)
          l = base_path.length

          method_name_file_part = i ? file_path[i+l+1,file_path.length-l-1] : file_path.clone
          method_name_file_part.sub!(/\.r(ht|x)ml$/,'')
          method_name_file_part.tr!('/:-', '_')
          method_name_file_part.gsub!(/[^a-zA-Z0-9_]/){|s| s[0].to_s}

          method_name += method_name_file_part
        else
          @@inline_template_count += 1
          method_name << @@inline_template_count.to_s
        end

        @@method_names[file_name || template] = method_name.intern
      end
Register or log in to add new notes.