Sha256: 3891f9496768aedc83a0b6c48bbe0271e1456c6c70717d35e0f220da343c89dd

Contents?: true

Size: 645 Bytes

Versions: 3

Compression:

Stored size: 645 Bytes

Contents

module Mascot
  module Extensions
    # Removes files beginning with "_" from the resource collection.
    class IndexRequestPath
      # Name of the file that we'll want to change to a / path
      FILE_NAME = "index.html".freeze

      def initialize(file_name: FILE_NAME)
        @file_name = file_name
      end

      def process_resources(resources)
        resources.each do |r|
          if r.asset.path.basename.to_s.start_with? @file_name
            # TODO: Conslidate this into SafeRoot.
            r.request_path = Pathname.new("/").join(r.request_path).dirname.cleanpath.to_s
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mascot-rails-0.1.11 lib/mascot/extensions/index_request_path.rb
mascot-rails-0.1.10 lib/mascot/extensions/index_request_path.rb
mascot-rails-0.1.9 lib/mascot/extensions/index_request_path.rb