method
assign_method_name
v1.0.0 -
Show latest stable
-
0 notes -
Class: ActionView::Base
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
assign_method_name(extension, template, file_name)
private
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