Class: EntryFilter
- Inherits:
-
Object
- Object
- EntryFilter
- Defined in:
- lib/jekyll/entry_filter.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #backup?(entry) ⇒ Boolean
- #excluded?(entry) ⇒ Boolean
- #filter(entries) ⇒ Object
- #included?(entry) ⇒ Boolean
-
#initialize(site) ⇒ EntryFilter
constructor
A new instance of EntryFilter.
- #special?(entry) ⇒ Boolean
- #symlink?(entry) ⇒ Boolean
Constructor Details
#initialize(site) ⇒ EntryFilter
Returns a new instance of EntryFilter.
3 4 5 |
# File 'lib/jekyll/entry_filter.rb', line 3 def initialize(site) @site = site end |
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
2 3 4 |
# File 'lib/jekyll/entry_filter.rb', line 2 def site @site end |
Instance Method Details
#backup?(entry) ⇒ Boolean
23 24 25 |
# File 'lib/jekyll/entry_filter.rb', line 23 def backup?(entry) entry[-1..-1] == '~' end |
#excluded?(entry) ⇒ Boolean
27 28 29 |
# File 'lib/jekyll/entry_filter.rb', line 27 def excluded?(entry) site.exclude.glob_include?(entry) end |
#filter(entries) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/jekyll/entry_filter.rb', line 7 def filter(entries) entries.reject do |e| unless included?(e) special?(e) || backup?(e) || excluded?(e) || symlink?(e) end end end |
#included?(entry) ⇒ Boolean
15 16 17 |
# File 'lib/jekyll/entry_filter.rb', line 15 def included?(entry) site.include.glob_include?(entry) end |
#special?(entry) ⇒ Boolean
19 20 21 |
# File 'lib/jekyll/entry_filter.rb', line 19 def special?(entry) ['.', '_', '#'].include?(entry[0..0]) end |
#symlink?(entry) ⇒ Boolean
31 32 33 |
# File 'lib/jekyll/entry_filter.rb', line 31 def symlink?(entry) File.symlink?(entry) && site.safe end |