aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template/resolver.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-06-20 23:37:01 +0200
committerXavier Noria <fxn@hashref.com>2015-06-20 23:40:11 +0200
commit29959eb59da3cedee71d29fe84e82cfa71ad4cf3 (patch)
treebc37b12a3902ba4084781f6c20fb0a19474b2799 /actionview/lib/action_view/template/resolver.rb
parentd8c22275faa738f1f0e6ff004bcc81488eab87c9 (diff)
downloadrails-29959eb59da3cedee71d29fe84e82cfa71ad4cf3.tar.gz
rails-29959eb59da3cedee71d29fe84e82cfa71ad4cf3.tar.bz2
rails-29959eb59da3cedee71d29fe84e82cfa71ad4cf3.zip
applies project style guidelines
Just saw these in passing while reading this file.
Diffstat (limited to 'actionview/lib/action_view/template/resolver.rb')
-rw-r--r--actionview/lib/action_view/template/resolver.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb
index 916d30e751..2b00b0303d 100644
--- a/actionview/lib/action_view/template/resolver.rb
+++ b/actionview/lib/action_view/template/resolver.rb
@@ -181,9 +181,9 @@ module ActionView
def query(path, details, formats)
query = build_query(path, details)
- template_paths = find_template_paths query
+ template_paths = find_template_paths(query)
- template_paths.map { |template|
+ template_paths.map do |template|
handler, format, variant = extract_handler_and_format_and_variant(template, formats)
contents = File.binread(template)
@@ -193,22 +193,22 @@ module ActionView
:variant => variant,
:updated_at => mtime(template)
)
- }
+ end
end
def find_template_paths(query)
- Dir[query].reject { |filename|
+ Dir[query].reject do |filename|
File.directory?(filename) ||
# deals with case-insensitive file systems.
!File.fnmatch(query, filename, File::FNM_EXTGLOB)
- }
+ end
end
# Helper for building query glob string based on resolver's pattern.
def build_query(path, details)
query = @pattern.dup
- prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
+ prefix = path.prefix.empty? ? '' : "#{escape_entry(path.prefix)}\\1"
query.gsub!(/:prefix(\/)?/, prefix)
partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
@@ -234,7 +234,7 @@ module ActionView
# from the path, or the handler, we should return the array of formats given
# to the resolver.
def extract_handler_and_format_and_variant(path, default_formats)
- pieces = File.basename(path).split(".")
+ pieces = File.basename(path).split('.')
pieces.shift
extension = pieces.pop