Merge pull request #4950 from pathawks/rubocop/entry_filter

Merge pull request 4950
This commit is contained in:
jekyllbot 2016-05-26 08:25:55 -07:00
commit 87acab9a86
2 changed files with 9 additions and 7 deletions

View File

@ -15,7 +15,6 @@ AllCops:
- lib/jekyll/deprecator.rb - lib/jekyll/deprecator.rb
- lib/jekyll/document.rb - lib/jekyll/document.rb
- lib/jekyll/drops/site_drop.rb - lib/jekyll/drops/site_drop.rb
- lib/jekyll/entry_filter.rb
- lib/jekyll/filters.rb - lib/jekyll/filters.rb
- lib/jekyll/frontmatter_defaults.rb - lib/jekyll/frontmatter_defaults.rb
- lib/jekyll/liquid_renderer/table.rb - lib/jekyll/liquid_renderer/table.rb

View File

@ -2,7 +2,7 @@ module Jekyll
class EntryFilter class EntryFilter
attr_reader :site attr_reader :site
SPECIAL_LEADING_CHARACTERS = [ SPECIAL_LEADING_CHARACTERS = [
'.', '_', '#', '~' ".", "_", '#', "~"
].freeze ].freeze
def initialize(site, base_directory = nil) def initialize(site, base_directory = nil)
@ -37,8 +37,7 @@ module Jekyll
def included?(entry) def included?(entry)
glob_include?(site.include, glob_include?(site.include,
entry entry)
)
end end
def special?(entry) def special?(entry)
@ -47,12 +46,17 @@ module Jekyll
end end
def backup?(entry) def backup?(entry)
entry[-1..-1] == '~' entry[-1..-1] == "~"
end end
def excluded?(entry) def excluded?(entry)
excluded = glob_include?(site.exclude, relative_to_source(entry)) excluded = glob_include?(site.exclude, relative_to_source(entry))
Jekyll.logger.debug "EntryFilter:", "excluded #{relative_to_source(entry)}" if excluded if excluded
Jekyll.logger.debug(
"EntryFilter:",
"excluded #{relative_to_source(entry)}"
)
end
excluded excluded
end end
@ -83,7 +87,6 @@ module Jekyll
def glob_include?(enum, e) def glob_include?(enum, e)
entry = Pathutil.new(site.in_source_dir).join(e) entry = Pathutil.new(site.in_source_dir).join(e)
enum.any? do |exp| enum.any? do |exp|
# Users who send a Regexp knows what they want to # Users who send a Regexp knows what they want to
# exclude, so let them send a Regexp to exclude files, # exclude, so let them send a Regexp to exclude files,
# we will not bother caring if it works or not, it's # we will not bother caring if it works or not, it's