Module: ActionView::LookupContext::ViewPaths

Included in:
ActionView::LookupContext
Defined in:
lib/action_view/lookup_context.rb

Overview

Helpers related to template lookup using the lookup context information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#html_fallback_for_jsObject (readonly)

Returns the value of attribute html_fallback_for_js.



126
127
128
# File 'lib/action_view/lookup_context.rb', line 126

def html_fallback_for_js
  @html_fallback_for_js
end

#view_pathsObject (readonly)

Returns the value of attribute view_paths.



126
127
128
# File 'lib/action_view/lookup_context.rb', line 126

def view_paths
  @view_paths
end

Instance Method Details

#any?(name, prefixes = [], partial = false) ⇒ Boolean Also known as: any_templates?

Returns:

  • (Boolean)


148
149
150
151
152
# File 'lib/action_view/lookup_context.rb', line 148

def any?(name, prefixes = [], partial = false)
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for_any
  @view_paths.exists?(name, prefixes, partial, details, details_key, [])
end

#append_view_paths(paths) ⇒ Object



155
156
157
# File 'lib/action_view/lookup_context.rb', line 155

def append_view_paths(paths)
  @view_paths = build_view_paths(@view_paths.to_a + paths)
end

#exists?(name, prefixes = [], partial = false, keys = [], **options) ⇒ Boolean Also known as: template_exists?

Returns:

  • (Boolean)


141
142
143
144
145
# File 'lib/action_view/lookup_context.rb', line 141

def exists?(name, prefixes = [], partial = false, keys = [], **options)
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.exists?(name, prefixes, partial, details, details_key, keys)
end

#find(name, prefixes = [], partial = false, keys = [], options = {}) ⇒ Object Also known as: find_template



128
129
130
131
132
# File 'lib/action_view/lookup_context.rb', line 128

def find(name, prefixes = [], partial = false, keys = [], options = {})
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.find(name, prefixes, partial, details, details_key, keys)
end

#find_all(name, prefixes = [], partial = false, keys = [], options = {}) ⇒ Object



135
136
137
138
139
# File 'lib/action_view/lookup_context.rb', line 135

def find_all(name, prefixes = [], partial = false, keys = [], options = {})
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.find_all(name, prefixes, partial, details, details_key, keys)
end

#prepend_view_paths(paths) ⇒ Object



159
160
161
# File 'lib/action_view/lookup_context.rb', line 159

def prepend_view_paths(paths)
  @view_paths = build_view_paths(paths + @view_paths.to_a)
end