Module: ActionView::LookupContext::ViewPaths

Included in:
ActionView::LookupContext
Defined in:
actionview/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



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

def html_fallback_for_js
  @html_fallback_for_js
end

#view_pathsObject (readonly)

Returns the value of attribute view_paths



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

def view_paths
  @view_paths
end

Instance Method Details

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

Returns:

  • (Boolean)


144
145
146
147
148
# File 'actionview/lib/action_view/lookup_context.rb', line 144

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



151
152
153
# File 'actionview/lib/action_view/lookup_context.rb', line 151

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)


137
138
139
140
141
# File 'actionview/lib/action_view/lookup_context.rb', line 137

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



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

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



131
132
133
134
135
# File 'actionview/lib/action_view/lookup_context.rb', line 131

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



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

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