lib/nice_partials.rb in nice_partials-0.1.9 vs lib/nice_partials.rb in nice_partials-0.9.0

- old
+ new

@@ -2,12 +2,11 @@ require_relative "nice_partials/version" module NicePartials def self.locale_prefix_from(lookup_context, block) - root_paths = lookup_context.view_paths.map(&:path) partial_location = block.source_location.first.dup - root_paths.each { |path| partial_location.gsub!(/^#{path}\//, '') } + lookup_context.view_paths.each { partial_location.delete_prefix!(_1.path)&.delete_prefix!("/") } partial_location.split('.').first.gsub('/_', '/').gsub('/', '.') end end ActiveSupport.on_load :action_view do