Module: ActionView::ViewPaths

Extended by:
ActiveSupport::Concern
Included in:
Rendering
Defined in:
lib/action_view/view_paths.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_view_pathsObject



84
85
86
# File 'lib/action_view/view_paths.rb', line 84

def self.all_view_paths
  @all_view_paths.values.uniq
end

.get_view_paths(klass) ⇒ Object



76
77
78
# File 'lib/action_view/view_paths.rb', line 76

def self.get_view_paths(klass)
  @all_view_paths[klass] || get_view_paths(klass.superclass)
end

.set_view_paths(klass, paths) ⇒ Object



80
81
82
# File 'lib/action_view/view_paths.rb', line 80

def self.set_view_paths(klass, paths)
  @all_view_paths[klass] = paths
end

Instance Method Details

#_prefixesObject

The prefixes used in render “foo” shortcuts.



90
91
92
# File 'lib/action_view/view_paths.rb', line 90

def _prefixes # :nodoc:
  self.class._prefixes
end

#append_view_path(path) ⇒ Object

Append a path to the list of view paths for the current LookupContext.

Parameters

  • path - If a String is provided, it gets converted into the default view path. You may also provide a custom view path (see ActionView::PathSet for more information)



112
113
114
# File 'lib/action_view/view_paths.rb', line 112

def append_view_path(path)
  lookup_context.view_paths.push(*path)
end

#details_for_lookupObject



102
103
104
# File 'lib/action_view/view_paths.rb', line 102

def details_for_lookup
  {}
end

#lookup_contextObject

LookupContext is the object responsible for holding all information required for looking up templates, i.e. view paths and details. Check ActionView::LookupContext for more information.



97
98
99
100
# File 'lib/action_view/view_paths.rb', line 97

def lookup_context
  @_lookup_context ||=
    ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes)
end

#prepend_view_path(path) ⇒ Object

Prepend a path to the list of view paths for the current LookupContext.

Parameters

  • path - If a String is provided, it gets converted into the default view path. You may also provide a custom view path (see ActionView::PathSet for more information)



122
123
124
# File 'lib/action_view/view_paths.rb', line 122

def prepend_view_path(path)
  lookup_context.view_paths.unshift(*path)
end