Skip to content

Instantly share code, notes, and snippets.

@SLiNv
Created April 11, 2019 02:23
Show Gist options
  • Save SLiNv/3cf7ba2eb080467daa358cd8d15826fc to your computer and use it in GitHub Desktop.
Save SLiNv/3cf7ba2eb080467daa358cd8d15826fc to your computer and use it in GitHub Desktop.
class PathResolver < Resolver #:nodoc:
EXTENSIONS = { locale: ".", formats: ".", variants: "+", handlers: "." }
DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}"
...
private
def find_templates(name, prefix, partial, details, outside_app_allowed = false)
path = Path.build(name, prefix, partial)
# Note details and details[:formats] are used here
query(path, details, details[:formats], outside_app_allowed)
end
def query(path, details, formats, outside_app_allowed)
query = build_query(path, details)
template_paths = find_template_paths(query)
...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment