diff --git a/lib/deface/override.rb b/lib/deface/override.rb index b37893c..bba1632 100644 --- a/lib/deface/override.rb +++ b/lib/deface/override.rb @@ -196,7 +196,7 @@ def digest # def self.digest(details) overrides = self.find(details) - to_hash = overrides.inject('') { |digest, override| digest << override.digest } + to_hash = overrides.inject(''.freeze) { |digest, override| digest << override.digest } Deface::Digest.hexdigest(to_hash) end diff --git a/lib/deface/search.rb b/lib/deface/search.rb index c4f5daf..31a2fd7 100644 --- a/lib/deface/search.rb +++ b/lib/deface/search.rb @@ -10,12 +10,15 @@ def find(details) virtual_path = details[:virtual_path] return [] if virtual_path.nil? - [/^\//, /\.\w+\z/].each { |regex| virtual_path.gsub!(regex, '') } + [/^\//, /\.\w+\z/].each { |regex| virtual_path.gsub!(regex, ''.freeze) } result = [] result << self.all[virtual_path.to_sym].try(:values) + + result = result.flatten + result.compact! - result.flatten.compact.sort_by &:sequence + result.sort_by &:sequence end # finds all overrides that are using a template / parital as there source