Sha256: 4c7affda6d380aadda4840ae0959c696d128d3de107cee8f836cabe425b6de7a

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

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

ActiveSupport.on_load :action_view do
  require_relative "nice_partials/monkey_patch"

  require_relative "nice_partials/helper"
  include NicePartials::Helper
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nice_partials-0.1.9 lib/nice_partials.rb