diff options
Diffstat (limited to 'actionview/lib/action_view/testing/resolvers.rb')
-rw-r--r-- | actionview/lib/action_view/testing/resolvers.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb index 2664aca991..f072664535 100644 --- a/actionview/lib/action_view/testing/resolvers.rb +++ b/actionview/lib/action_view/testing/resolvers.rb @@ -1,4 +1,4 @@ -require 'action_view/template/resolver' +require "action_view/template/resolver" module ActionView #:nodoc: # Use FixtureResolver in your tests to simulate the presence of files on the @@ -14,7 +14,7 @@ module ActionView #:nodoc: end def to_s - @hash.keys.join(', ') + @hash.keys.join(", ") end private @@ -22,32 +22,31 @@ module ActionView #:nodoc: def query(path, exts, formats, _) query = "" EXTENSIONS.each_key do |ext| - query << '(' << exts[ext].map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' + query << "(" << exts[ext].map { |e| e && Regexp.escape(".#{e}") }.join("|") << "|)" end query = /^(#{Regexp.escape(path)})#{query}$/ templates = [] @hash.each do |_path, array| source, updated_at = array - next unless _path =~ query + next unless query.match?(_path) handler, format, variant = extract_handler_and_format_and_variant(_path, formats) templates << Template.new(source, _path, handler, - :virtual_path => path.virtual, - :format => format, - :variant => variant, - :updated_at => updated_at + virtual_path: path.virtual, + format: format, + variant: variant, + updated_at: updated_at ) end - templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } + templates.sort_by { |t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } end end class NullResolver < PathResolver def query(path, exts, formats, _) handler, format, variant = extract_handler_and_format_and_variant(path, formats) - [ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, :virtual_path => path.virtual, :format => format, :variant => variant)] + [ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant)] end end end - |