Module: NicePartials

Defined in:
lib/nice_partials.rb,
lib/nice_partials/partial.rb,
lib/nice_partials/version.rb

Defined Under Namespace

Modules: CapturingYieldDetection, Helper, PartialRendering, RenderingWithAutoContext, RenderingWithLocalePrefix Classes: Partial

Constant Summary collapse

VERSION =
"0.1.9"
DEPRECATOR =
ActiveSupport::Deprecation.new("1.0", "nice_partials")

Class Method Summary collapse

Class Method Details

.locale_prefix_from(lookup_context, block) ⇒ Object



6
7
8
9
10
11
# File 'lib/nice_partials.rb', line 6

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}\//, '') }
  partial_location.split('.').first.gsub('/_', '/').gsub('/', '.')
end