Sha256: b72e64250354e8a46f8aac603ce8316de15a2a4a78dfc8381bc29d4fe158593e

Contents?: true

Size: 505 Bytes

Versions: 4

Compression:

Stored size: 505 Bytes

Contents

module Mascot
  module Extensions
    # Removes files beginning with "_" from the resource collection.
    class PartialsRemover
      # Partial rails prefix.
      PARTIAL_PREFIX = "_".freeze

      def process_resources(resources)
        resources.each do |r|
          resources.remove r if self.class.partial? r.asset.path # Looks like a smiley face, doesn't it?
        end
      end

      def self.partial?(path)
        File.basename(path).starts_with? PARTIAL_PREFIX
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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