Class: Jekyll::AwesomeNav::PageSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/jekyll/awesome_nav/page_set.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, config) ⇒ PageSet

Returns a new instance of PageSet.



8
9
10
11
12
13
14
15
16
# File 'lib/jekyll/awesome_nav/page_set.rb', line 8

def initialize(site, config)
  @pages = site.pages.select do |page|
    next false if File.basename(page.path) == config.nav_filename

    dir = Utils.source_dir_for(page)
    dir == config.root_dir || dir.start_with?("#{config.root_dir}/")
  end
  @root_dir = config.root_dir
end

Instance Method Details

#each(&block) ⇒ Object



18
19
20
# File 'lib/jekyll/awesome_nav/page_set.rb', line 18

def each(&block)
  @pages.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/jekyll/awesome_nav/page_set.rb', line 22

def empty?
  @pages.empty?
end

#root_pageObject



26
27
28
# File 'lib/jekyll/awesome_nav/page_set.rb', line 26

def root_page
  @pages.find { |page| Utils.source_dir_for(page) == @root_dir && Utils.index_page?(page) }
end