Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added blacklist for digest #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions lib/non-stupid-digest-assets.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
module NonStupidDigestAssets
mattr_accessor :whitelist
mattr_accessor :whitelist, :blacklist
@@whitelist = []
@@blacklist = []

class << self

def files(files)
return files if whitelist.empty?
whitelisted_files(files)
return files if whitelist.empty? && blacklist.empty?
w_files = whitelist.present? ? whitelisted_files(files) : files
return blacklist.present? ? blacklisted_files(w_files) : w_files
end

private

def blacklisted_files(files)
files.select do |file, info|
blacklist.any? do |item|
item != info['logical_path']
end
end
end

def whitelisted_files(files)
files.select do |file, info|
Expand Down