Class: ActionView::TemplatePath
Relationships & Source Files | |
Inherits: | Object |
Defined in: | actionview/lib/action_view/template_path.rb |
Overview
Represents a template path within ActionView’s lookup and rendering system, like “users/show”
TemplatePath
makes it convenient to convert between separate name, prefix, partial arguments and the virtual path.
Class Method Summary
-
.build(name, prefix, partial)
Convert name, prefix, and partial into a
TemplatePath
. - .new(name, prefix, partial, virtual) ⇒ TemplatePath constructor
-
.parse(virtual)
Build a
TemplatePath
form a virtual path. -
.virtual(name, prefix, partial)
Convert name, prefix, and partial into a virtual path string.
Instance Attribute Summary
Instance Method Summary
- #partial (also: #partial?) readonly
Constructor Details
.new(name, prefix, partial, virtual) ⇒ TemplatePath
Class Method Details
.build(name, prefix, partial)
Convert name, prefix, and partial into a TemplatePath
.parse(virtual)
Build a TemplatePath
form a virtual path
# File 'actionview/lib/action_view/template_path.rb', line 28
def self.parse(virtual) if nameidx = virtual.rindex("/") prefix = virtual[0, nameidx] name = virtual.from(nameidx + 1) prefix = prefix[1..] if prefix.start_with?("/") else prefix = "" name = virtual end partial = name.start_with?("_") name = name[1..] if partial new name, prefix, partial, virtual end
.virtual(name, prefix, partial)
Convert name, prefix, and partial into a virtual path string
Instance Attribute Details
#name (readonly)
[ GitHub ]#partial? (readonly)
Alias for #partial.
# File 'actionview/lib/action_view/template_path.rb', line 13
alias_method :partial?, :partial
#prefix (readonly)
[ GitHub ]#to_s (readonly)
Alias for #virtual.
# File 'actionview/lib/action_view/template_path.rb', line 55
alias :to_s :virtual
#to_str (readonly)
Alias for #virtual.
# File 'actionview/lib/action_view/template_path.rb', line 54
alias :to_str :virtual
#virtual (readonly) Also known as: #virtual_path, #to_str, #to_s
[ GitHub ]#virtual_path (readonly)
Alias for #virtual.
# File 'actionview/lib/action_view/template_path.rb', line 14
alias_method :virtual_path, :virtual