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

adds file blacklist #6

Merged
merged 4 commits into from
Dec 6, 2016
Merged

adds file blacklist #6

merged 4 commits into from
Dec 6, 2016

Conversation

nick-benoit14
Copy link
Contributor

  • Adds file blacklist so only desired files are uploaded

@@ -61,12 +69,19 @@ def self.iterate_xml(resources, zip_file)
resources_array - ["", nil]
end

def self.black_listed?(name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider?

def self.black_listed?(name)
  !FILE_BLACK_LIST.include? name
end

def self.iterate_files(zip_file)
resources_array = []
zip_file.entries.each do |entry|
filtered_entries = zip_file.entries.select { |e| black_listed? e.name }
filtered_entries.each do |entry|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's refactor this too.

  def self.iterate_files(zip_file)
    zip_file.
      entries.
      select { |entry| black_listed? entry.name }.
      map { |entry| BlacklightFile.new(entry) }
  end

Copy link
Contributor

@bfcoder bfcoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@nick-benoit14 nick-benoit14 merged commit 7e15110 into master Dec 6, 2016
@nick-benoit14 nick-benoit14 deleted the add_content branch December 6, 2016 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants